News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Evan Coury's Blog:
Sharing a database connection across modules in Zend Framework 2
April 27, 2012 @ 09:54:56

Evan Coury has a new post to his site about a handy method for sharing database connections across modules in a Zend Framework application.

With the new modular infrastructure in Zend Framework 2, one of the most common questions will indoubitably be how to share a database connection across modules. Here's a quick explanation of how to share your database connection across multiple modules in a way that can even allow you to use a single connection between ZendDb, Doctrine2, and possibly even other database libraries / ORMs.

He includes the code in the post to configure this application-wide database resource, a "masterdb_pdo" that uses a MySQL backend. This configuration is used to set up the connection in a dependency injection container for later (globalish) use. He also mentions something similar about sharing Doctrine connections with the ZendDb components (using the same DI container approach).

0 comments voice your opinion now!
share database connection module application zenddb zenddi doctrine2


blog comments powered by Disqus

Similar Posts

DevArticles: Creating the Front End of a Search Engine with AJAX

Stefan Mischook's Blog: What Makes a PHP Web Application?

Aura Blog: A Peek At Aura v2 -- Aura.Sql and ExtendedPdo

Tobias Schlitt's Blog: At IPC2k7: WebDAV will come over you...

Paul Jones' Blog: Solar 0.21 and 0.22 released in quick succession


Community Events





Don't see your event here?
Let us know!


opinion interview voicesoftheelephpant conference release podcast artisanfiles community composer symfony laravel series library list framework security introduction version language tool

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework