コード例 #1
0
 public function __construct(ConnectionInterface $conn, Configuration $config, EventDispatcherInterface $dispatcher)
 {
     $this->conn = $conn;
     $this->config = $config;
     $this->dispatcher = $dispatcher;
     $this->repoFactory = $config->getRepositoryFactory();
     $this->uow = new UnitOfWork($this->conn, $config->getIdentityMap(), $config->getMetadataRegistry(), $config->getProxyFactory(), $dispatcher);
 }
コード例 #2
0
 /**
  * Create a new entity manager instance
  *
  * @param array $conn Connection parameters
  * @param Configuration $config
  *
  * @return EntityManagerInterface
  */
 public static function make(array $conn, Configuration $config, EventDispatcherInterface $dispatcher = null)
 {
     if ($dispatcher === null) {
         $dispatcher = new EventDispatcher();
     }
     $repoFactory = new RepositoryFactory($config->getIdentityMap(), $config->getMetadataRegistry());
     $config->setRepositoryFactory($repoFactory);
     $connection = ConnectionFactory::make($conn, $dispatcher);
     return new EntityManager($connection, $config, $dispatcher);
 }