Пример #1
0
 protected function getConnection()
 {
     if (is_null($this->app)) {
         $this->app = $this->getApplication();
     }
     $this->em = EntityManagerFactory::initializeTestEntityManager($this->app);
     $pdo = $this->em->getConnection()->getWrappedConnection();
     $this->em->clear();
     $tool = new \Doctrine\ORM\Tools\SchemaTool($this->em);
     $classes = $this->em->getMetadataFactory()->getAllMetadata();
     $tool->dropSchema($classes);
     $tool->createSchema($classes);
     return $this->createDefaultDBConnection($pdo, 'fcms_test');
 }