doctrine2 - What is the best way to use doctrine entity manager in application? Can be many doctrine entity manager instances? -


i write mini php framework. not understand how deal doctrine 2 entity manager.

1) can many doctrine entity manager instances? can create new instance in view, in controller, , in other classes of program?

for example, conn.php contains logics how connect database, , create entity manager instance $em.

class some1 {     private $em;      public function __construct() {       require 'conn.php'       $this->em = $em;     } }  class some2 {     private $em;      public function __construct() {       require 'conn.php'       $this->em = $em;     } }  class some13 {     private $em;      public function __construct() {       require 'conn.php'       $this->em = $em;     } } 

2) shall create 1 wrapping class, , make em static variable in it?


Comments

Popular posts from this blog

javascript - Confirm a form & display message if form is valid with JQuery -

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -