function createDoctrineConfig($cache, $cachedAnnotationReader) { AnnotationRegistry::registerFile(dirname(__DIR__) . "/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php"); //$cache = new Doctrine\Common\Cache\ArrayCache; // if (extension_loaded('apc')) { // $cache = new \Doctrine\Common\Cache\ApcCache(); // } else { // $cache = new \Doctrine\Common\Cache\PhpFileCache(); // } $isDevMode = true; // $annotationReader = new AnnotationReader; // $cachedAnnotationReader = new Doctrine\Common\Annotations\CachedReader( // $annotationReader, // use reader // $cache // and a cache driver // ); $annotationDriver = new Doctrine\ORM\Mapping\Driver\AnnotationDriver($cachedAnnotationReader, array(__DIR__ . '/Resource')); $driverChain = new Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain(); Gedmo\DoctrineExtensions::registerAbstractMappingIntoDriverChainORM($driverChain, $cachedAnnotationReader); $driverChain->addDriver($annotationDriver, 'Uppu4\\Entity'); $config = Setup::createAnnotationMetadataConfiguration(array(__DIR__ . "/Resource"), $isDevMode); //!!!!!! $config = new Doctrine\ORM\Configuration(); $config->setProxyDir(sys_get_temp_dir()); $config->setProxyNamespace('Proxy'); $config->setAutoGenerateProxyClasses(true); // this can be based on production config. // register metadata driver $config->setMetadataDriverImpl($driverChain); // use our already initialized cache driver $config->setMetadataCacheImpl($cache); $config->setQueryCacheImpl($cache); $deleted = $cache->deleteAll(); return $config; }
/** * Initialize Doctrine * @return Doctrine_Manager */ public function _initDoctrine() { // include and register Doctrine's class loader require_once 'Doctrine/Common/ClassLoader.php'; $classLoader = new \Doctrine\Common\ClassLoader('Doctrine', APPLICATION_PATH . '/../library/'); $classLoader->register(); // create the Doctrine configuration $config = new \Doctrine\ORM\Configuration(); // setting the cache ( to ArrayCache. Take a look at // the Doctrine manual for different options ! ) $cache = new \Doctrine\Common\Cache\ArrayCache(); $config->setMetadataCacheImpl($cache); $config->setQueryCacheImpl($cache); // choosing the driver for our database schema // we'll use annotations $driver = $config->newDefaultAnnotationDriver(APPLICATION_PATH . '/models'); $config->setMetadataDriverImpl($driver); // set the proxy dir and set some options $config->setProxyDir(APPLICATION_PATH . '/models/Proxies'); $config->setAutoGenerateProxyClasses(true); $config->setProxyNamespace('App\\Proxies'); // now create the entity manager and use the connection // settings we defined in our application.ini $connectionSettings = $this->getOption('doctrine'); $conn = array('driver' => $connectionSettings['conn']['driv'], 'user' => $connectionSettings['conn']['user'], 'password' => $connectionSettings['conn']['pass'], 'dbname' => $connectionSettings['conn']['dbname'], 'host' => $connectionSettings['conn']['host']); $entityManager = \Doctrine\ORM\EntityManager::create($conn, $config); // push the entity manager into our registry for later use $registry = Zend_Registry::getInstance(); $registry->entitymanager = $entityManager; return $entityManager; }
public static function _init_manager($connection) { $settings = static::connection_settings($connection); $config = new \Doctrine\ORM\Configuration(); $cache = static::_init_cache($settings); if ($cache) { $config->setMetadataCacheImpl($cache); $config->setQueryCacheImpl($cache); $config->setResultCacheImpl($cache); } $config->setProxyDir($settings['proxy_dir']); $config->setProxyNamespace($settings['proxy_namespace']); $config->setAutoGenerateProxyClasses(\Arr::get($settings, 'auto_generate_proxy_classes', false)); $config->setMetadataDriverImpl(static::_init_metadata($config, $settings)); $EventManager = new \Doctrine\Common\EventManager(); static::$_managers[$connection] = \Doctrine\ORM\EntityManager::create($settings['connection'], $config, $EventManager); if (!empty($settings['profiling'])) { static::$_managers[$connection]->getConnection()->getConfiguration()->setSQLLogger(new Doctrine\Logger($connection)); } // Connection init callback if (!empty($settings['init_callback'])) { // If array merge combined this numeric array, grab last two array elements as the real callback if (is_array($settings['init_callback']) && count($settings['init_callback']) > 2) { $settings['init_callback'] = array_slice($settings['init_callback'], -2); } call_user_func($settings['init_callback'], static::$_managers[$connection], $connection); } }
protected function _initDoctrine() { require_once LIBRARY_PATH . '/Doctrine/Common/ClassLoader.php'; $autoloader = \Zend_Loader_Autoloader::getInstance(); $fmmAutoloader = new \Doctrine\Common\ClassLoader(); $autoloader->pushAutoloader(array($fmmAutoloader, 'loadClass')); $options = $this->getOptions(); $config = new Doctrine\ORM\Configuration(); $config->addCustomDatetimeFunction('YEAR', 'Doctrine\\Extensions\\Query\\Mysql\\Year'); $config->addCustomDatetimeFunction('MONTH', 'Doctrine\\Extensions\\Query\\Mysql\\Month'); $config->addCustomDatetimeFunction('DAY', 'Doctrine\\Extensions\\Query\\Mysql\\Day'); $config->addCustomStringFunction('DATEDIFF', 'Doctrine\\Extensions\\Query\\Mysql\\DateDiff'); $config->addCustomStringFunction('DATE_FORMAT', 'Doctrine\\Extensions\\Query\\Mysql\\DateFormat'); $config->addCustomStringFunction('IF', 'Doctrine\\Extensions\\Query\\Mysql\\IfElse'); $config->addCustomStringFunction('GROUP_CONCAT', 'Doctrine\\Extensions\\Query\\Mysql\\GroupConcat'); $config->addCustomStringFunction('IFNULL', 'Doctrine\\Extensions\\Query\\Mysql\\IfNull'); $config->setProxyDir($options['doctrine']['metadata']['proxyDir']); $config->setProxyNamespace('Doctrine\\Proxy'); $config->setAutoGenerateProxyClasses(true); $config->setAutoGenerateProxyClasses(APPLICATION_ENV == 'development'); //$driverImpl = $config->newDefaultAnnotationDriver($options['metadata']['entityDir']); $driverImpl = new Doctrine\ORM\Mapping\Driver\YamlDriver($options['doctrine']['metadata']['entityDir']); $config->setMetadataDriverImpl($driverImpl); $cache = new Doctrine\Common\Cache\ArrayCache(); $config->setMetadataCacheImpl($cache); $config->setQueryCacheImpl($cache); $evm = new Doctrine\Common\EventManager(); $em = Doctrine\ORM\EntityManager::create($options['doctrine']['db'], $config, $evm); Zend_Registry::set('doctrine', $em); return $em; }
protected function getDoctrine_Orm_DefaultEntityManagerService() { $a = new \Doctrine\Common\Cache\ArrayCache(); $a->setNamespace('sf2orm_default_009ddab573918805ac10dd8e02df21ad9f522de9b39f898aae553f354da1859d'); $b = new \Doctrine\Common\Cache\ArrayCache(); $b->setNamespace('sf2orm_default_009ddab573918805ac10dd8e02df21ad9f522de9b39f898aae553f354da1859d'); $c = new \Doctrine\Common\Cache\ArrayCache(); $c->setNamespace('sf2orm_default_009ddab573918805ac10dd8e02df21ad9f522de9b39f898aae553f354da1859d'); $d = new \Doctrine\ORM\Mapping\Driver\DriverChain(); $d->addDriver(new \Doctrine\ORM\Mapping\Driver\AnnotationDriver($this->get('annotation_reader'), array(0 => '/home/haritz/symfony2/marca/src/uni/bundle/marcaBundle/Entity')), 'uni\\bundle\\marcaBundle\\Entity'); $e = new \Doctrine\ORM\Configuration(); $e->setEntityNamespaces(array('uniMarcaBundle' => 'uni\\bundle\\marcaBundle\\Entity')); $e->setMetadataCacheImpl($a); $e->setQueryCacheImpl($b); $e->setResultCacheImpl($c); $e->setMetadataDriverImpl($d); $e->setProxyDir('/home/haritz/symfony2/marca/app/cache/prod/doctrine/orm/Proxies'); $e->setProxyNamespace('Proxies'); $e->setAutoGenerateProxyClasses(false); $e->setClassMetadataFactoryName('Doctrine\\ORM\\Mapping\\ClassMetadataFactory'); $e->setDefaultRepositoryClassName('Doctrine\\ORM\\EntityRepository'); $e->setNamingStrategy(new \Doctrine\ORM\Mapping\DefaultNamingStrategy()); $this->services['doctrine.orm.default_entity_manager'] = $instance = \Doctrine\ORM\EntityManager::create($this->get('doctrine.dbal.default_connection'), $e); $this->get('doctrine.orm.default_manager_configurator')->configure($instance); return $instance; }
protected function getDoctrine_Orm_DefaultEntityManagerService() { $a = new \Doctrine\Common\Cache\ArrayCache(); $a->setNamespace('sf2orm_default_212f582878cf7474c20ecc1bd0f75efb89c7ef7c7a33110da091960837c6c845'); $b = new \Doctrine\Common\Cache\ArrayCache(); $b->setNamespace('sf2orm_default_212f582878cf7474c20ecc1bd0f75efb89c7ef7c7a33110da091960837c6c845'); $c = new \Doctrine\Common\Cache\ArrayCache(); $c->setNamespace('sf2orm_default_212f582878cf7474c20ecc1bd0f75efb89c7ef7c7a33110da091960837c6c845'); $d = new \Doctrine\ORM\Mapping\Driver\DriverChain(); $d->addDriver(new \Doctrine\ORM\Mapping\Driver\AnnotationDriver($this->get('annotation_reader'), array(0 => '/home/andoni/symfony2/Marca/src/Uni/Bundle/MarcaBundle/Entity')), 'Uni\\Bundle\\MarcaBundle\\Entity'); $e = new \Doctrine\ORM\Configuration(); $e->setEntityNamespaces(array('uniMarcaBundle' => 'Uni\\Bundle\\MarcaBundle\\Entity')); $e->setMetadataCacheImpl($a); $e->setQueryCacheImpl($b); $e->setResultCacheImpl($c); $e->setMetadataDriverImpl($d); $e->setProxyDir('/home/andoni/symfony2/Marca/app/cache/prod/doctrine/orm/Proxies'); $e->setProxyNamespace('Proxies'); $e->setAutoGenerateProxyClasses(false); $e->setClassMetadataFactoryName('Doctrine\\ORM\\Mapping\\ClassMetadataFactory'); $e->setDefaultRepositoryClassName('Doctrine\\ORM\\EntityRepository'); $e->setNamingStrategy(new \Doctrine\ORM\Mapping\DefaultNamingStrategy()); $this->services['doctrine.orm.default_entity_manager'] = $instance = \Doctrine\ORM\EntityManager::create($this->get('doctrine.dbal.default_connection'), $e); $this->get('doctrine.orm.default_manager_configurator')->configure($instance); return $instance; }
/** * Factory method which creates an EntityManager. * * @return \Doctrine\ORM\EntityManager */ public function create() { $config = new \Doctrine\ORM\Configuration(); $config->setClassMetadataFactoryName('TYPO3\\Flow\\Persistence\\Doctrine\\Mapping\\ClassMetadataFactory'); $cache = new \TYPO3\Flow\Persistence\Doctrine\CacheAdapter(); // must use ObjectManager in compile phase... $cache->setCache($this->objectManager->get('TYPO3\\Flow\\Cache\\CacheManager')->getCache('Flow_Persistence_Doctrine')); $config->setMetadataCacheImpl($cache); $config->setQueryCacheImpl($cache); $resultCache = new \TYPO3\Flow\Persistence\Doctrine\CacheAdapter(); // must use ObjectManager in compile phase... $resultCache->setCache($this->objectManager->get('TYPO3\\Flow\\Cache\\CacheManager')->getCache('Flow_Persistence_Doctrine_Results')); $config->setResultCacheImpl($resultCache); if (class_exists($this->settings['doctrine']['sqlLogger'])) { $config->setSQLLogger(new $this->settings['doctrine']['sqlLogger']()); } $eventManager = $this->buildEventManager(); $flowAnnotationDriver = $this->objectManager->get('TYPO3\\Flow\\Persistence\\Doctrine\\Mapping\\Driver\\FlowAnnotationDriver'); $config->setMetadataDriverImpl($flowAnnotationDriver); $proxyDirectory = \TYPO3\Flow\Utility\Files::concatenatePaths(array($this->environment->getPathToTemporaryDirectory(), 'Doctrine/Proxies')); \TYPO3\Flow\Utility\Files::createDirectoryRecursively($proxyDirectory); $config->setProxyDir($proxyDirectory); $config->setProxyNamespace('TYPO3\\Flow\\Persistence\\Doctrine\\Proxies'); $config->setAutoGenerateProxyClasses(FALSE); $entityManager = \Doctrine\ORM\EntityManager::create($this->settings['backendOptions'], $config, $eventManager); $flowAnnotationDriver->setEntityManager($entityManager); \Doctrine\DBAL\Types\Type::addType('objectarray', 'TYPO3\\Flow\\Persistence\\Doctrine\\DataTypes\\ObjectArray'); if (isset($this->settings['doctrine']['filters']) && is_array($this->settings['doctrine']['filters'])) { foreach ($this->settings['doctrine']['filters'] as $filterName => $filterClass) { $config->addFilter($filterName, $filterClass); $entityManager->getFilters()->enable($filterName); } } return $entityManager; }
protected function getDoctrine_Orm_DefaultEntityManagerService() { require_once '/var/www/Symfony/app/cache/prod/jms_diextra/doctrine/EntityManager.php'; $a = new \Doctrine\Common\Cache\ArrayCache(); $a->setNamespace('sf2orm_default_a92f94852d95a1e374806d6b93dd509c'); $b = new \Doctrine\Common\Cache\ArrayCache(); $b->setNamespace('sf2orm_default_a92f94852d95a1e374806d6b93dd509c'); $c = new \Doctrine\Common\Cache\ArrayCache(); $c->setNamespace('sf2orm_default_a92f94852d95a1e374806d6b93dd509c'); $d = new \Doctrine\ORM\Mapping\Driver\DriverChain(); $d->addDriver(new \Doctrine\ORM\Mapping\Driver\AnnotationDriver($this->get('annotation_reader'), array(0 => '/var/www/Symfony/src/Form/FormBundle/Entity')), 'Form\\FormBundle\\Entity'); $e = new \Doctrine\ORM\Configuration(); $e->setEntityNamespaces(array('FormFormBundle' => 'Form\\FormBundle\\Entity')); $e->setMetadataCacheImpl($a); $e->setQueryCacheImpl($b); $e->setResultCacheImpl($c); $e->setMetadataDriverImpl($d); $e->setProxyDir('/var/www/Symfony/app/cache/prod/doctrine/orm/Proxies'); $e->setProxyNamespace('Proxies'); $e->setAutoGenerateProxyClasses(false); $e->setClassMetadataFactoryName('Doctrine\\ORM\\Mapping\\ClassMetadataFactory'); $e->setDefaultRepositoryClassName('Doctrine\\ORM\\EntityRepository'); $e->setNamingStrategy(new \Doctrine\ORM\Mapping\DefaultNamingStrategy()); $f = call_user_func(array('Doctrine\\ORM\\EntityManager', 'create'), $this->get('doctrine.dbal.default_connection'), $e); $this->get('doctrine.orm.default_manager_configurator')->configure($f); return $this->services['doctrine.orm.default_entity_manager'] = new \EM50865219e3628_546a8d27f194334ee012bfe64f629947b07e4919\__CG__\Doctrine\ORM\EntityManager($f, $this); }
protected function getDoctrine_Orm_DefaultEntityManagerService() { require_once '/opt/lampp/htdocs/symfony2/symfony/app/cache/prod/jms_diextra/doctrine/EntityManager_509982243f179.php'; $a = new \Doctrine\Common\Cache\ArrayCache(); $a->setNamespace('sf2orm_default_3f1b97459909d5be8f95fdd1560f907a'); $b = new \Doctrine\Common\Cache\ArrayCache(); $b->setNamespace('sf2orm_default_3f1b97459909d5be8f95fdd1560f907a'); $c = new \Doctrine\Common\Cache\ArrayCache(); $c->setNamespace('sf2orm_default_3f1b97459909d5be8f95fdd1560f907a'); $d = new \Doctrine\ORM\Configuration(); $d->setEntityNamespaces(array()); $d->setMetadataCacheImpl($a); $d->setQueryCacheImpl($b); $d->setResultCacheImpl($c); $d->setMetadataDriverImpl(new \Doctrine\ORM\Mapping\Driver\DriverChain()); $d->setProxyDir('/opt/lampp/htdocs/symfony2/symfony/app/cache/prod/doctrine/orm/Proxies'); $d->setProxyNamespace('Proxies'); $d->setAutoGenerateProxyClasses(false); $d->setClassMetadataFactoryName('Doctrine\\ORM\\Mapping\\ClassMetadataFactory'); $d->setDefaultRepositoryClassName('Doctrine\\ORM\\EntityRepository'); $d->setNamingStrategy(new \Doctrine\ORM\Mapping\DefaultNamingStrategy()); $e = call_user_func(array('Doctrine\\ORM\\EntityManager', 'create'), $this->get('doctrine.dbal.default_connection'), $d); $this->get('doctrine.orm.default_manager_configurator')->configure($e); return $this->services['doctrine.orm.default_entity_manager'] = new \EntityManager509982243f179_546a8d27f194334ee012bfe64f629947b07e4919\__CG__\Doctrine\ORM\EntityManager($e, $this); }
/** * {@inheritdoc} */ public function register(\Silex\Application $app) { $app['annotation.reader.internal'] = $app->share(function () use($app) { return new \Doctrine\Common\Annotations\AnnotationReader(); }); $app['annotation.reader'] = $app->share(function () use($app) { return new \Doctrine\Common\Annotations\CachedReader($app['annotation.reader.internal'], $app['app.cache']); }); $app['orm.config.annotation.driver'] = $app->share(function () use($app) { return new \Doctrine\ORM\Mapping\Driver\AnnotationDriver($app['annotation.reader'], array(__DIR__ . '/Organizations')); }); $app['orm.config'] = $app->share(function () use($app) { $config = new \Doctrine\ORM\Configuration(); $config->setMetadataCacheImpl($app['app.cache']); $config->setResultCacheImpl($app['app.cache']); $config->setQueryCacheImpl($app['app.cache']); $config->setProxyDir($app['db.orm.proxies_dir']); $config->setProxyNamespace($app['db.orm.proxies_namespace']); $config->setAutoGenerateProxyClasses($app['db.orm.auto_generate_proxies']); $config->setMetadataDriverImpl($app['orm.config.annotation.driver']); return $config; }); $app['orm.em'] = $app->share(function () use($app) { return \Doctrine\ORM\EntityManager::create($app['db'], $app['orm.config'], $app['db.event_manager']); }); }
protected function getDoctrine_Orm_DefaultEntityManagerService() { $a = new \Doctrine\Common\Cache\ArrayCache(); $a->setNamespace('sf2orm_default_8d769ce4aa22abd637c7b7052818602e040efc33d69a70ac4544342291b37ba8'); $b = new \Doctrine\Common\Cache\ArrayCache(); $b->setNamespace('sf2orm_default_8d769ce4aa22abd637c7b7052818602e040efc33d69a70ac4544342291b37ba8'); $c = new \Doctrine\Common\Cache\ArrayCache(); $c->setNamespace('sf2orm_default_8d769ce4aa22abd637c7b7052818602e040efc33d69a70ac4544342291b37ba8'); $d = new \Doctrine\ORM\Mapping\Driver\DriverChain(); $d->addDriver(new \Doctrine\ORM\Mapping\Driver\AnnotationDriver($this->get('annotation_reader'), array(0 => '/home/iker/symfony2/marca/src/uni/bundle/marcaBundle/Entity')), 'uni\\bundle\\marcaBundle\\Entity'); $e = new \Doctrine\ORM\Configuration(); $e->setEntityNamespaces(array('uniMarcaBundle' => 'uni\\bundle\\marcaBundle\\Entity')); $e->setMetadataCacheImpl($a); $e->setQueryCacheImpl($b); $e->setResultCacheImpl($c); $e->setMetadataDriverImpl($d); $e->setProxyDir('/home/iker/symfony2/marca/app/cache/prod/doctrine/orm/Proxies'); $e->setProxyNamespace('Proxies'); $e->setAutoGenerateProxyClasses(false); $e->setClassMetadataFactoryName('Doctrine\\ORM\\Mapping\\ClassMetadataFactory'); $e->setDefaultRepositoryClassName('Doctrine\\ORM\\EntityRepository'); $e->setNamingStrategy(new \Doctrine\ORM\Mapping\DefaultNamingStrategy()); $this->services['doctrine.orm.default_entity_manager'] = $instance = \Doctrine\ORM\EntityManager::create($this->get('doctrine.dbal.default_connection'), $e); $this->get('doctrine.orm.default_manager_configurator')->configure($instance); return $instance; }
/** * Initialize doctrine * * @return void */ protected function initializeDoctrine() { $doctrineConfiguration = new \Doctrine\ORM\Configuration(); // Proxy configuration $doctrineConfiguration->setProxyDir(ROOT . 'Data/Proxies/Doctrine/'); $doctrineConfiguration->setProxyNamespace('LEA\\Proxies'); $doctrineConfiguration->setAutoGenerateProxyClasses(APPLICATION_CONTEXT == 'development'); // Mapping Configuration //$driverImpl = new Doctrine\ORM\Mapping\Driver\XmlDriver(__DIR__."/config/mappings/xml"); //$driverImpl = new Doctrine\ORM\Mapping\Driver\XmlDriver(__DIR__."/config/mappings/yml"); $driverImpl = $doctrineConfiguration->newDefaultAnnotationDriver(ROOT . 'Application/Domain/Model/'); $doctrineConfiguration->setMetadataDriverImpl($driverImpl); // Caching Configuration //if (APPLICATION_CONTEXT == 'development') { $cache = new \Doctrine\Common\Cache\ArrayCache(); //} else { // $cache = new \Doctrine\Common\Cache\ApcCache(); //} $doctrineConfiguration->setMetadataCacheImpl($cache); $doctrineConfiguration->setQueryCacheImpl($cache); // database configuration parameters $conn = array('driver' => $this->configuration['database']['driver'], 'user' => $this->configuration['database']['username'], 'password' => $this->configuration['database']['password'], 'dbname' => $this->configuration['database']['dbname'], 'host' => $this->configuration['database']['host']); // obtaining the entity manager $evm = new \Doctrine\Common\EventManager(); $this->entityManager = \Doctrine\ORM\EntityManager::create($conn, $doctrineConfiguration, $evm); }
protected function getDoctrine_Orm_DefaultEntityManagerService() { $a = new \Doctrine\Common\Cache\ArrayCache(); $a->setNamespace('sf2orm_default_9d968dc3678c378fa217a1250471e79fb7e4263cf64827a5f1c8cd74fdb740d9'); $b = new \Doctrine\Common\Cache\ArrayCache(); $b->setNamespace('sf2orm_default_9d968dc3678c378fa217a1250471e79fb7e4263cf64827a5f1c8cd74fdb740d9'); $c = new \Doctrine\Common\Cache\ArrayCache(); $c->setNamespace('sf2orm_default_9d968dc3678c378fa217a1250471e79fb7e4263cf64827a5f1c8cd74fdb740d9'); $d = new \Doctrine\ORM\Mapping\Driver\DriverChain(); $d->addDriver(new \Doctrine\ORM\Mapping\Driver\AnnotationDriver($this->get('annotation_reader'), array(0 => '/home/itziar/web/synfony2/itziar-superheroes/src/uni/bundle/superhBundle/Entity')), 'uni\\bundle\\superhBundle\\Entity'); $e = new \Doctrine\ORM\Configuration(); $e->setEntityNamespaces(array('uniSuperhBundle' => 'uni\\bundle\\superhBundle\\Entity')); $e->setMetadataCacheImpl($a); $e->setQueryCacheImpl($b); $e->setResultCacheImpl($c); $e->setMetadataDriverImpl($d); $e->setProxyDir('/home/itziar/web/synfony2/itziar-superheroes/app/cache/prod/doctrine/orm/Proxies'); $e->setProxyNamespace('Proxies'); $e->setAutoGenerateProxyClasses(false); $e->setClassMetadataFactoryName('Doctrine\\ORM\\Mapping\\ClassMetadataFactory'); $e->setDefaultRepositoryClassName('Doctrine\\ORM\\EntityRepository'); $e->setNamingStrategy(new \Doctrine\ORM\Mapping\DefaultNamingStrategy()); $this->services['doctrine.orm.default_entity_manager'] = $instance = \Doctrine\ORM\EntityManager::create($this->get('doctrine.dbal.default_connection'), $e); $this->get('doctrine.orm.default_manager_configurator')->configure($instance); return $instance; }
protected function getDoctrine_Orm_DefaultEntityManagerService() { $a = new \Doctrine\Common\Cache\ArrayCache(); $a->setNamespace('sf2orm_default_34fb07f8c5c30a0161dab82f751c8632e441929962e443e4f0acfa325886b164'); $b = new \Doctrine\Common\Cache\ArrayCache(); $b->setNamespace('sf2orm_default_34fb07f8c5c30a0161dab82f751c8632e441929962e443e4f0acfa325886b164'); $c = new \Doctrine\Common\Cache\ArrayCache(); $c->setNamespace('sf2orm_default_34fb07f8c5c30a0161dab82f751c8632e441929962e443e4f0acfa325886b164'); $d = new \Doctrine\ORM\Mapping\Driver\DriverChain(); $d->addDriver(new \Doctrine\ORM\Mapping\Driver\AnnotationDriver($this->get('annotation_reader'), array(0 => '/home/itziar/web/synfony2/recetas/src/uni/bundle/recetasBundle/Entity')), 'uni\\bundle\\recetasBundle\\Entity'); $e = new \Doctrine\ORM\Configuration(); $e->setEntityNamespaces(array('uniRecetasBundle' => 'uni\\bundle\\recetasBundle\\Entity')); $e->setMetadataCacheImpl($a); $e->setQueryCacheImpl($b); $e->setResultCacheImpl($c); $e->setMetadataDriverImpl($d); $e->setProxyDir('/home/itziar/web/synfony2/recetas/app/cache/prod/doctrine/orm/Proxies'); $e->setProxyNamespace('Proxies'); $e->setAutoGenerateProxyClasses(false); $e->setClassMetadataFactoryName('Doctrine\\ORM\\Mapping\\ClassMetadataFactory'); $e->setDefaultRepositoryClassName('Doctrine\\ORM\\EntityRepository'); $e->setNamingStrategy(new \Doctrine\ORM\Mapping\DefaultNamingStrategy()); $this->services['doctrine.orm.default_entity_manager'] = $instance = \Doctrine\ORM\EntityManager::create($this->get('doctrine.dbal.default_connection'), $e); $this->get('doctrine.orm.default_manager_configurator')->configure($instance); return $instance; }
protected function getDoctrine_Orm_DefaultEntityManagerService() { $a = new \Doctrine\Common\Cache\ArrayCache(); $a->setNamespace('sf2orm_default_d8b0087a585fd8d1a917703a03663dadd0fbb62170bcdd10b61d3f5a3b162bd9'); $b = new \Doctrine\Common\Cache\ArrayCache(); $b->setNamespace('sf2orm_default_d8b0087a585fd8d1a917703a03663dadd0fbb62170bcdd10b61d3f5a3b162bd9'); $c = new \Doctrine\Common\Cache\ArrayCache(); $c->setNamespace('sf2orm_default_d8b0087a585fd8d1a917703a03663dadd0fbb62170bcdd10b61d3f5a3b162bd9'); $d = new \Doctrine\ORM\Mapping\Driver\DriverChain(); $d->addDriver(new \Doctrine\ORM\Mapping\Driver\AnnotationDriver($this->get('annotation_reader'), array(0 => '/home/ivan/symfony2/juegos/src/uniJuegos/Bundle/Entity')), 'uniJuegos\\Bundle\\Entity'); $e = new \Doctrine\ORM\Configuration(); $e->setEntityNamespaces(array('uniJuegosBundle' => 'uniJuegos\\Bundle\\Entity')); $e->setMetadataCacheImpl($a); $e->setQueryCacheImpl($b); $e->setResultCacheImpl($c); $e->setMetadataDriverImpl($d); $e->setProxyDir('/home/ivan/symfony2/juegos/app/cache/prod/doctrine/orm/Proxies'); $e->setProxyNamespace('Proxies'); $e->setAutoGenerateProxyClasses(false); $e->setClassMetadataFactoryName('Doctrine\\ORM\\Mapping\\ClassMetadataFactory'); $e->setDefaultRepositoryClassName('Doctrine\\ORM\\EntityRepository'); $e->setNamingStrategy(new \Doctrine\ORM\Mapping\DefaultNamingStrategy()); $this->services['doctrine.orm.default_entity_manager'] = $instance = \Doctrine\ORM\EntityManager::create($this->get('doctrine.dbal.default_connection'), $e); $this->get('doctrine.orm.default_manager_configurator')->configure($instance); return $instance; }
private function init() { if (!class_exists('PDO') || !in_array('sqlite', \PDO::getAvailableDrivers())) { \PHPUnit_Framework_TestCase::markTestSkipped('This test requires SQLite support in your environment'); } $config = new \Doctrine\ORM\Configuration(); $config->setEntityNamespaces(array('UebbHateoasBundle' => 'uebb\\HateoasBundle\\Tests\\Entity')); $config->setAutoGenerateProxyClasses(true); $config->setProxyDir(\sys_get_temp_dir()); $config->setProxyNamespace('UebbHateoasTests\\Doctrine'); $reader = new AnnotationReader(); $metadataDriver = new AnnotationDriver($reader, 'uebb\\HateoasBundle\\Tests\\Entity'); $config->setMetadataDriverImpl($metadataDriver); $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache()); $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache()); $params = array('driver' => 'pdo_sqlite', 'memory' => true); $this->entityManager = EntityManager::create($params, $config); $this->linkParser = $this->getMock('uebb\\HateoasBundle\\Service\\LinkParserInterface'); $this->linkResolver = $this->getMock('uebb\\HateoasBundle\\Service\\LinkResolverInterface'); $this->dispatcher = $this->getMock('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface'); $this->formResolver = new FormResolver($this->factory, $reader); $this->queryParser = $this->getMock('uebb\\HateoasBundle\\Service\\QueryParserInterface'); $this->serializer = $this->getMock('JMS\\Serializer\\SerializerInterface'); $this->validator = $this->getMock('Symfony\\Component\\Validator\\Validator\\ValidatorInterface'); $this->requestProcessor = new RequestProcessor($this->entityManager, $this->linkParser, $this->linkResolver, $this->formResolver, $this->dispatcher, $this->queryParser, $this->serializer, $this->validator); }
/** * Creates an entity manager to use for all tests * * @return Doctrine\ORM\EntityManager */ protected function _createEntityManager() { $conn = \Doctrine\DBAL\DriverManager::getConnection(array('driver' => 'pdo_sqlite', 'memory' => true)); $config = new \Doctrine\ORM\Configuration(); $config->setProxyDir(__DIR__ . '/../Proxies'); $config->setProxyNamespace('DoctrineExtensions\\NestedSet\\Tests\\Proxies'); $config->setMetadataDriverImpl(\Doctrine\ORM\Mapping\Driver\AnnotationDriver::create()); $config->setAutoGenerateProxyClasses(true); return \Doctrine\ORM\EntityManager::create($conn, $config); }
function createEntityManager() { $config = new \Doctrine\ORM\Configuration(); $cache = new \Doctrine\Common\Cache\ApcCache(); $config->setMetadataCacheImpl($cache); $config->setQueryCacheImpl($cache); $config->setProxyDir(dirname(dirname(__DIR__)) . '/demo/Proxies'); $config->setProxyNamespace('\\demo\\Proxies'); $config->setAutoGenerateProxyClasses(true); $connectionOptions = array('dbname' => 'ssdev', 'user' => 'ssdev', 'password' => 'ssdev', 'unix_socket' => '/var/run/mysqld/mysqld.sock', 'driver' => 'pdo_mysql'); return \Doctrine\ORM\EntityManager::create($connectionOptions, $config); }
protected static function createConfiguration($dsn) { $conf = new \Doctrine\ORM\Configuration(); $cache = new $CONFIG['doctrine.cache'](); $conf->setQueryCacheImpl($cache); $conf->setMetadataCacheImpl($cache); $conf->setMetadataDriverImpl($conf->newDefaultAnnotationDriver(array(patchworkPath($CONFIG['doctrine.entities.dir'])))); $conf->setProxyDir(patchworkPath($CONFIG['doctrine.proxy.dir'])); $conf->setAutoGenerateProxyClasses($CONFIG['doctrine.proxy.generate']); $conf->setProxyNamespace($CONFIG['doctrine.proxy.namespace']); return $conf; }
/** * @return EntityManager */ protected function createTestEntityManager() { $config = new \Doctrine\ORM\Configuration(); $config->setAutoGenerateProxyClasses(true); $config->setProxyDir(\sys_get_temp_dir()); $config->setProxyNamespace('SymfonyTests\\Doctrine'); $config->setMetadataDriverImpl($config->newDefaultAnnotationDriver()); $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache()); $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache()); $params = array('driver' => 'pdo_sqlite', 'memory' => true); return EntityManager::create($params, $config); }
public function setUp() { $config = new \Doctrine\ORM\Configuration(); $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache()); $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache()); $config->setProxyDir(__DIR__ . '/Proxies'); $config->setProxyNamespace('DoctrineExtensions\\Tests\\Proxies'); $config->setAutoGenerateProxyClasses(true); $config->setMetadataDriverImpl($config->newDefaultAnnotationDriver(__DIR__ . '/../Entities')); $config->setCustomStringFunctions(array('LISTAGG' => 'DoctrineExtensions\\Query\\Oracle\\Listagg')); $this->entityManager = \Doctrine\ORM\EntityManager::create(array('driver' => 'pdo_sqlite', 'memory' => true), $config); }
private static function createConfiguration() { $applicationMode = "development"; if ($applicationMode == "development") { $cache = new Doctrine\Common\Cache\ArrayCache(); } else { $cache = new Doctrine\Common\Cache\ApcCache(); } $config = new Doctrine\ORM\Configuration(); $config->setMetadataCacheImpl($cache); $driverImpl = $config->newDefaultAnnotationDriver(THISPATH . '/entities'); $config->setMetadataDriverImpl($driverImpl); $config->setQueryCacheImpl($cache); $config->setProxyDir(THISPATH . '/proxy'); $config->setProxyNamespace('Verify\\Proxies'); if ($applicationMode == "development") { $config->setAutoGenerateProxyClasses(true); } else { $config->setAutoGenerateProxyClasses(false); } self::$config = $config; }
public function setUp() { $config = new \Doctrine\ORM\Configuration(); $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache()); $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache()); $config->setProxyDir(__DIR__ . '/Proxies'); $config->setProxyNamespace('DoctrineExtensions\\Tests\\Proxies'); $config->setAutoGenerateProxyClasses(true); $config->setMetadataDriverImpl($config->newDefaultAnnotationDriver(__DIR__ . '/../Entities')); $config->setCustomStringFunctions(array('STR_TO_DATE' => 'DoctrineExtensions\\Query\\Postgresql\\StrToDate', 'COUNT_FILTER' => 'DoctrineExtensions\\Query\\Postgresql\\CountFilterFunction')); $config->setCustomDateTimeFunctions(array('DATE_FORMAT' => 'DoctrineExtensions\\Query\\Postgresql\\DateFormat', 'AT_TIME_ZONE' => 'DoctrineExtensions\\Query\\Postgresql\\AtTimeZoneFunction')); $this->entityManager = \Doctrine\ORM\EntityManager::create(array('driver' => 'pdo_sqlite', 'memory' => true), $config); }
protected function getEntityManager() { $config = new \Doctrine\ORM\Configuration(); $config->setEntityNamespaces(['SymfonyTestsDoctrine' => 'Symfony\\Bridge\\Doctrine\\Tests\\Fixtures']); $config->setAutoGenerateProxyClasses(true); $config->setProxyDir(\sys_get_temp_dir()); $config->setProxyNamespace('SymfonyTests\\Doctrine'); $config->setMetadataDriverImpl(new \Doctrine\ORM\Mapping\Driver\AnnotationDriver(new \Doctrine\Common\Annotations\AnnotationReader())); $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache()); $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache()); $params = ['driver' => 'pdo_sqlite', 'memory' => true]; return \Doctrine\ORM\EntityManager::create($params, $config); }
public function setUp() { $config = new \Doctrine\ORM\Configuration(); $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache()); $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache()); $config->setProxyDir(__DIR__ . '/Proxies'); $config->setProxyNamespace('DoctrineExtensions\\Tests\\Proxies'); $config->setAutoGenerateProxyClasses(true); $config->setMetadataDriverImpl($config->newDefaultAnnotationDriver(__DIR__ . '/../Entities')); $config->setCustomDatetimeFunctions(array('DATEADD' => 'DoctrineExtensions\\Query\\Mysql\\DateAdd', 'DATEDIFF' => 'DoctrineExtensions\\Query\\Mysql\\DateDiff', 'DATESUB' => 'DoctrineExtensions\\Query\\Mysql\\DateSub', 'FROM_UNIXTIME' => 'DoctrineExtensions\\Query\\Mysql\\FromUnixtime', 'UNIX_TIMESTAMP' => 'DoctrineExtensions\\Query\\Mysql\\UnixTimestamp')); $config->setCustomNumericFunctions(array('ACOS' => 'DoctrineExtensions\\Query\\Mysql\\Acos', 'ASIN' => 'DoctrineExtensions\\Query\\Mysql\\Asin', 'ATAN' => 'DoctrineExtensions\\Query\\Mysql\\Atan', 'ATAN2' => 'DoctrineExtensions\\Query\\Mysql\\Atan2', 'COS' => 'DoctrineExtensions\\Query\\Mysql\\Cos', 'COT' => 'DoctrineExtensions\\Query\\Mysql\\Cot', 'DEGREES' => 'DoctrineExtensions\\Query\\Mysql\\Degrees', 'RADIANS' => 'DoctrineExtensions\\Query\\Mysql\\Radians', 'SIN' => 'DoctrineExtensions\\Query\\Mysql\\Sin', 'TAN' => 'DoctrineExtensions\\Query\\Mysql\\Tan')); $config->setCustomStringFunctions(array('ASCII' => 'DoctrineExtensions\\Query\\Mysql\\Ascii', 'CHAR_LENGTH' => 'DoctrineExtensions\\Query\\Mysql\\CharLength', 'CONCAT_WS' => 'DoctrineExtensions\\Query\\Mysql\\ConcatWs', 'FIELD' => 'DoctrineExtensions\\Query\\Mysql\\Field', 'FIND_IN_SET' => 'DoctrineExtensions\\Query\\Mysql\\FindInSet', 'LEAST' => 'DoctrineExtensions\\Query\\Mysql\\Least', 'REPLACE' => 'DoctrineExtensions\\Query\\Mysql\\Replace', 'SOUNDEX' => 'DoctrineExtensions\\Query\\Mysql\\Soundex', 'STR_TO_DATE' => 'DoctrineExtensions\\Query\\Mysql\\StrToDate', 'SUBSTRING_INDEX' => 'DoctrineExtensions\\Query\\Mysql\\SubstringIndex')); $this->entityManager = \Doctrine\ORM\EntityManager::create(array('driver' => 'pdo_sqlite', 'memory' => true), $config); }
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; }
protected function createEntityManager($conn) { $config = new \Doctrine\ORM\Configuration(); $config->setProxyDir(__DIR__ . '/../../../Proxies'); $config->setProxyNamespace('MyProject\\Proxies'); $config->setAutoGenerateProxyClasses(true); $annotDriver = $config->newDefaultAnnotationDriver(array(__DIR__ . '/../../../Models/')); $config->setMetadataDriverImpl($annotDriver); $cache = new \Doctrine\Common\Cache\ArrayCache(); $config->setMetadataCacheImpl($cache); $config->setQueryCacheImpl($cache); $config->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger()); $em = \Doctrine\ORM\EntityManager::create($conn, $config); return $em; }
/** * @return EntityManager */ public static function createTestEntityManager($paths = array()) { if (!class_exists('PDO') || !in_array('sqlite', \PDO::getAvailableDrivers())) { self::markTestSkipped('This test requires SQLite support in your environment'); } $config = new \Doctrine\ORM\Configuration(); $config->setAutoGenerateProxyClasses(true); $config->setProxyDir(\sys_get_temp_dir()); $config->setProxyNamespace('SymfonyTests\\Doctrine'); $config->setMetadataDriverImpl(new AnnotationDriver(new IndexedReader(new AnnotationReader()))); $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache()); $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache()); $params = array('driver' => 'pdo_sqlite', 'memory' => true); return EntityManager::create($params, $config); }
/** * @return Doctrine\ORM\EntityManager */ protected function createEntityManager() { AnnotationRegistry::registerFile(__DIR__ . "/../../vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php"); $annotationDriver = new AnnotationDriver(new AnnotationReader(), __DIR__ . "/Entity"); $config = new \Doctrine\ORM\Configuration(); $config->setAutoGenerateProxyClasses(true); $config->setProxyDir(\sys_get_temp_dir()); $config->setProxyNamespace('Psamatt\\Proxies'); $config->setMetadataCacheImpl($cache = new \Doctrine\Common\Cache\ArrayCache()); $config->setMetadataDriverImpl($annotationDriver); $config->setQueryCacheImpl($cache); $config->setEntityNamespaces(array('PsamattYamlExportBundle' => 'Psamatt\\YamlExportBundle\\Tests\\Command\\Entity')); $connectionOptions = array('driver' => 'pdo_sqlite', 'memory' => true); return \Doctrine\ORM\EntityManager::create($connectionOptions, $config); }
/** * Create an entityManager for testing * * @return EntityManager */ public function createTestEntityManager() { $config = new \Doctrine\ORM\Configuration(); $config->setEntityNamespaces(['SymfonyTestsDoctrine' => 'Symfony\\Bridge\\Doctrine\\Tests\\Fixtures']); $config->setAutoGenerateProxyClasses(true); $config->setProxyDir(\sys_get_temp_dir()); $config->setProxyNamespace('SymfonyTests\\Doctrine'); $bundlePath = __DIR__ . "/../../../../.."; $yamlDriver = new SimplifiedYamlDriver([$bundlePath . "/CatalogBundle/Resources/config/doctrine" => "Pim\\Bundle\\CatalogBundle\\Entity"]); $config->setMetadataDriverImpl($yamlDriver); $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache()); $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache()); $params = ['driver' => 'pdo_sqlite', 'memory' => true]; return EntityManager::create($params, $config); }