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
Post a Comment