Пример #1
0
 /**
  * @return EntityManagerInterface
  */
 public function getEntityManager()
 {
     if (null === $this->entityManager) {
         $doctrine = new Doctrine();
         $config = new SinergiConfig(__DIR__ . '/../../config');
         $connection = $config->get('doctrine.connection');
         $config->set('doctrine', ['connection' => array_merge($connection, ['host' => $this->getConfig()->getHost(), 'dbname' => $this->getConfig()->getDbname(), 'user' => $this->getConfig()->getUser(), 'password' => $this->getConfig()->getPassword()])]);
         $doctrine->setConfig($config);
         $this->entityManager = $doctrine->getEntityManager();
     }
     return $this->entityManager;
 }
Пример #2
0
 /**
  * @param string $configDir
  */
 public function __construct($configDir)
 {
     $this->config = new Config($configDir, 'dev');
     $this->doctrine = new Doctrine();
     $this->doctrine->setConfig($this->config);
 }