Пример #1
0
 static function initializeTestEntityManager($app, $applicationMode = "development")
 {
     $cache = new \Doctrine\Common\Cache\ArrayCache();
     $config = new \Doctrine\ORM\Configuration();
     $config->setMetadataCacheImpl($cache);
     //Load this paths from config file
     $driverImpl = $config->newDefaultAnnotationDriver(EntityManagerFactory::prepareEntityFoldersPaths($app));
     $config->setMetadataDriverImpl($driverImpl);
     $config->setQueryCacheImpl($cache);
     $config->setProxyDir(rtrim($app['rootFolderPath']) . DIRECTORY_SEPARATOR . "temp" . DIRECTORY_SEPARATOR);
     $config->setProxyNamespace('FCMS2\\DoctrineProxy');
     $config->setAutoGenerateProxyClasses(true);
     $em = EntityManager::create(array('driver' => 'pdo_sqlite', 'memory' => 'true'), $config);
     return $em;
 }