当前位置: 首页>>代码示例>>PHP>>正文


PHP Configuration::setMetadataCacheImpl方法代码示例

本文整理汇总了PHP中Doctrine\ORM\Configuration::setMetadataCacheImpl方法的典型用法代码示例。如果您正苦于以下问题:PHP Configuration::setMetadataCacheImpl方法的具体用法?PHP Configuration::setMetadataCacheImpl怎么用?PHP Configuration::setMetadataCacheImpl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Doctrine\ORM\Configuration的用法示例。


在下文中一共展示了Configuration::setMetadataCacheImpl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: initDoctrine

function initDoctrine()
{
    require_once __DIR__ . '/../lib/vendor/doctrine-common/lib/Doctrine/Common/ClassLoader.php';
    // Set up class loading. You could use different autoloaders, provided by your favorite framework,
    // if you want to.
    $classLoader = new ClassLoader('Doctrine\\ORM', realpath(__DIR__ . '/../lib'));
    $classLoader->register();
    $classLoader = new ClassLoader('Doctrine\\DBAL', realpath(__DIR__ . '/../lib/vendor/doctrine-dbal/lib'));
    $classLoader->register();
    $classLoader = new ClassLoader('Doctrine\\Common', realpath(__DIR__ . '/../lib/vendor/doctrine-common/lib'));
    $classLoader->register();
    $classLoader = new ClassLoader('Symfony', realpath(__DIR__ . '/../lib/vendor'));
    $classLoader->register();
    $classLoader = new ClassLoader('Entities', __DIR__);
    $classLoader->register();
    $classLoader = new ClassLoader('Proxies', __DIR__);
    $classLoader->register();
    // Set up caches
    $config = new Configuration();
    $cache = new ApcCache();
    $config->setMetadataCacheImpl($cache);
    $driverImpl = $config->newDefaultAnnotationDriver(array(__DIR__ . "/Entities"));
    $config->setMetadataDriverImpl($driverImpl);
    $config->setQueryCacheImpl($cache);
    // Proxy configuration
    $config->setProxyDir(__DIR__ . '/Proxies');
    $config->setProxyNamespace('Proxies');
    $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache());
    // Database connection information
    $connectionOptions = array('driver' => 'pdo_sqlite', 'path' => __DIR__ . '/database.sqlite');
    // Create EntityManager
    $em = EntityManager::create($connectionOptions, $config);
    return $em;
}
开发者ID:holdensmagicalunicorn,项目名称:RunThisApp,代码行数:34,代码来源:index.php

示例2: setUp

 public function setUp()
 {
     $this->configuration = new Configuration();
     $this->configuration->setMetadataCacheImpl(new ArrayCache());
     $this->configuration->setQueryCacheImpl(new ArrayCache());
     $this->configuration->setProxyDir(__DIR__ . '/Proxies');
     $this->configuration->setProxyNamespace('DoctrineExtensions\\Tests\\Proxies');
     $this->configuration->setAutoGenerateProxyClasses(true);
     $this->configuration->setMetadataDriverImpl($this->configuration->newDefaultAnnotationDriver(__DIR__ . '/../Entities'));
     $this->entityManager = EntityManager::create(array('driver' => 'pdo_sqlite', 'memory' => true), $this->configuration);
 }
开发者ID:beberlei,项目名称:DoctrineExtensions,代码行数:11,代码来源:DbTestCase.php

示例3: getEntityManager

 /**
  * @return EntityManager
  */
 protected function getEntityManager()
 {
     if (null !== $this->em) {
         return $this->em;
     }
     $config = new Configuration();
     $config->setMetadataCacheImpl(new ArrayCache());
     $config->setQueryCacheImpl(new ArrayCache());
     $config->setProxyDir(__DIR__ . '/Proxies');
     $config->setAutoGenerateProxyClasses(ProxyFactory::AUTOGENERATE_EVAL);
     $config->setProxyNamespace('SimpleThings\\EntityAudit\\Tests\\Proxies');
     $config->setMetadataDriverImpl($config->newDefaultAnnotationDriver(array(realpath(__DIR__ . '/Fixtures/Core'), realpath(__DIR__ . '/Fixtures/Issue'), realpath(__DIR__ . '/Fixtures/Relation')), false));
     Gedmo\DoctrineExtensions::registerAnnotations();
     $connection = $this->_getConnection();
     // get rid of more global state
     $evm = $connection->getEventManager();
     foreach ($evm->getListeners() as $event => $listeners) {
         foreach ($listeners as $listener) {
             $evm->removeEventListener(array($event), $listener);
         }
     }
     $this->em = EntityManager::create($connection, $config);
     if (isset($this->customTypes) and is_array($this->customTypes)) {
         foreach ($this->customTypes as $customTypeName => $customTypeClass) {
             if (!Type::hasType($customTypeName)) {
                 Type::addType($customTypeName, $customTypeClass);
             }
             $this->em->getConnection()->getDatabasePlatform()->registerDoctrineTypeMapping('db_' . $customTypeName, $customTypeName);
         }
     }
     return $this->em;
 }
开发者ID:Soullivaneuh,项目名称:EntityAudit,代码行数:35,代码来源:BaseTest.php

示例4: createEntityManager

 public static function createEntityManager($database)
 {
     $config = new Doctrine\ORM\Configuration();
     // annotations
     $annotationDriver = $config->newDefaultAnnotationDriver(array(APP_DIR . '/Model', NEURON_DIR . '/Model'));
     $config->setMetadataDriverImpl($annotationDriver);
     // proxy
     $config->setProxyNamespace('Neuron\\Proxy');
     $config->setProxyDir(TEMP_DIR);
     // cache
     $cache = Environment::isProduction() ? new NetteDoctrineCache() : new Doctrine\Common\Cache\ArrayCache();
     $config->setMetadataCacheImpl($cache);
     $config->setQueryCacheImpl($cache);
     // debugbar
     $config->setSQLLogger(Doctrine2Panel::getAndRegister());
     // entity manager
     $em = Doctrine\ORM\EntityManager::create((array) $database, $config);
     $evm = $em->getEventManager();
     $evm->addEventSubscriber(new Doctrine\DBAL\Event\Listeners\MysqlSessionInit("utf8", "utf8_czech_ci"));
     $evm->addEventSubscriber(new ValidationSubscriber());
     $evm->addEventSubscriber(new CacheSubscriber());
     $neonParser = new \Nette\NeonParser();
     $aliases = $neonParser->parse(file_get_contents(APP_DIR . "/entityClassAliases.neon"));
     $evm->addEventSubscriber(new \Neuron\Model\Doctrine\EntityClassAliasesSubscriber($aliases));
     return $em;
 }
开发者ID:janmarek,项目名称:Neuron,代码行数:26,代码来源:ServiceFactories.php

示例5: register

 public function register(Application $app)
 {
     //Load Doctrine Configuration
     $app['db.configuration'] = $app->share(function () use($app) {
         AnnotationRegistry::registerAutoloadNamespace("Doctrine\\ORM\\Mapping", __DIR__ . '/../../../../../doctrine/orm/lib');
         $config = new ORMConfiguration();
         $cache = $app['debug'] == false ? new ApcCache() : new ArrayCache();
         $config->setMetadataCacheImpl($cache);
         $config->setQueryCacheImpl($cache);
         $chain = new DriverChain();
         foreach ((array) $app['db.orm.entities'] as $entity) {
             switch ($entity['type']) {
                 case 'annotation':
                     $reader = new AnnotationReader();
                     $driver = new AnnotationDriver($reader, (array) $entity['path']);
                     $chain->addDriver($driver, $entity['namespace']);
                     break;
                     /*case 'yml':
                           $driver = new YamlDriver((array)$entity['path']);
                           $driver->setFileExtension('.yml');
                           $chain->addDriver($driver, $entity['namespace']);
                           break;
                       case 'xml':
                           $driver = new XmlDriver((array)$entity['path'], $entity['namespace']);
                           $driver->setFileExtension('.xml');
                           $chain->addDriver($driver, $entity['namespace']);
                           break;*/
                 /*case 'yml':
                       $driver = new YamlDriver((array)$entity['path']);
                       $driver->setFileExtension('.yml');
                       $chain->addDriver($driver, $entity['namespace']);
                       break;
                   case 'xml':
                       $driver = new XmlDriver((array)$entity['path'], $entity['namespace']);
                       $driver->setFileExtension('.xml');
                       $chain->addDriver($driver, $entity['namespace']);
                       break;*/
                 default:
                     throw new \InvalidArgumentException(sprintf('"%s" is not a recognized driver', $type));
                     break;
             }
         }
         $config->setMetadataDriverImpl($chain);
         $config->setProxyDir($app['db.orm.proxies_dir']);
         $config->setProxyNamespace($app['db.orm.proxies_namespace']);
         $config->setAutoGenerateProxyClasses($app['db.orm.auto_generate_proxies']);
         return $config;
     });
     //Set Defaut Configuration
     $defaults = array('entities' => array(array('type' => 'annotation', 'path' => 'Entity', 'namespace' => 'Entity')), 'proxies_dir' => 'cache/doctrine/Proxy', 'proxies_namespace' => 'DoctrineProxy', 'auto_generate_proxies' => true);
     foreach ($defaults as $key => $value) {
         if (!isset($app['db.orm.' . $key])) {
             $app['db.orm.' . $key] = $value;
         }
     }
     $self = $this;
     $app['db.orm.em'] = $app->share(function () use($self, $app) {
         return EntityManager::create($app['db'], $app['db.configuration']);
     });
 }
开发者ID:amenophis,项目名称:silex-doctrineorm,代码行数:60,代码来源:DoctrineORMServiceProvider.php

示例6: getConfiguration

 /**
  * getEntityManagerOptions
  *
  * Return the Doctrine ORM configuration instance 
  * 
  * @param array $options The options array
  * @return Doctrine\ORM\Configuration
  */
 protected function getConfiguration()
 {
     if (!isset($this->_config)) {
         $options = $this->getOptions();
         $config = new Configuration();
         $config->setProxyDir($options['proxydir']);
         if (APPLICATION_ENV == 'development') {
             $options['autogenerateproxies'] = true;
             $options['cache'] = 'array';
         }
         if (isset($options['cache'])) {
             $cache = $this->createCache($options['cache']);
             $config->setMetadataCacheImpl($cache);
             $config->setQueryCacheImpl($cache);
         }
         if (isset($options['proxynamespace'])) {
             $config->setProxyNamespace($options['proxynamespace']);
         }
         $config->setAutoGenerateProxyClasses(false);
         if (isset($options['autogenerateproxies']) && $options['autogenerateproxies']) {
             $config->setAutoGenerateProxyClasses(true);
         }
         $config->setMetadataDriverImpl($this->createMetadataDriver($options['metadatadriver'], $options['entitydir']));
         $this->_config = $config;
     }
     return $this->_config;
 }
开发者ID:alex-patterson-webdev,项目名称:multiverse,代码行数:35,代码来源:Entitymanager.php

示例7: createEntityManager

 /**
  * @return \Doctrine\ORM\EntityManager
  */
 protected function createEntityManager()
 {
     // event manager used to create schema before tests
     $eventManager = new EventManager();
     $eventManager->addEventListener(array("preTestSetUp"), new SchemaSetupListener());
     // doctrine xml configs and namespaces
     $configPathList = array();
     if (is_dir(__DIR__ . '/../Resources/config/doctrine')) {
         $dir = __DIR__ . '/../Resources/config/doctrine';
         $configPathList[] = $dir;
         $prefixList[$dir] = 'Kitpages\\DataGridBundle\\Entities';
     }
     if (is_dir(__DIR__ . '/_doctrine/config')) {
         $dir = __DIR__ . '/_doctrine/config';
         $configPathList[] = $dir;
         $prefixList[$dir] = 'Kitpages\\DataGridBundle\\Tests\\TestEntities';
     }
     // create drivers (that reads xml configs)
     $driver = new \Symfony\Bridge\Doctrine\Mapping\Driver\XmlDriver($configPathList);
     $driver->setNamespacePrefixes($prefixList);
     // create config object
     $config = new Configuration();
     $config->setMetadataCacheImpl(new ArrayCache());
     $config->setMetadataDriverImpl($driver);
     $config->setProxyDir(__DIR__ . '/TestProxies');
     $config->setProxyNamespace('Kitpages\\DataGridBundle\\Tests\\TestProxies');
     $config->setAutoGenerateProxyClasses(true);
     //$config->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger());
     // create entity manager
     $em = EntityManager::create(array('driver' => 'pdo_sqlite', 'path' => "/tmp/sqlite-test.db"), $config, $eventManager);
     return $em;
 }
开发者ID:radmar,项目名称:KitpagesDataGridBundle,代码行数:35,代码来源:BundleOrmTestCase.php

示例8: factory

 /**
  * @param array $settings
  * @param bool $debug
  * @return EntityManager
  * @throws \Doctrine\ORM\ORMException
  */
 public static function factory($settings, $debug = true)
 {
     if ($debug || !function_exists('apc_fetch')) {
         $cache = new ArrayCache();
     } else {
         $cache = new ApcCache();
     }
     $dbSettings = $settings['doctrine'];
     $config = new Configuration();
     $config->setMetadataCacheImpl($cache);
     // Do not use default Annotation driver
     $driverImpl = new AnnotationDriver(new AnnotationReader(), $dbSettings['entities']);
     // Allow all annotations
     AnnotationRegistry::registerLoader('class_exists');
     $config->setMetadataDriverImpl($driverImpl);
     $config->setQueryCacheImpl($cache);
     $config->setProxyDir($dbSettings['proxy_path']);
     $config->setProxyNamespace('Zaralab\\Doctrine\\Proxies');
     if ($debug) {
         $config->setAutoGenerateProxyClasses(true);
     } else {
         $config->setAutoGenerateProxyClasses(false);
     }
     $connectionOptions = $dbSettings['dbal'];
     return EntityManager::create($connectionOptions, $config);
 }
开发者ID:myovchev,项目名称:zaralab-api,代码行数:32,代码来源:Doctrine.php

示例9: __construct

 public function __construct()
 {
     // load database configuration from CodeIgniter
     require_once APPPATH . 'config/database.php';
     $doctrineClassLoader = new ClassLoader('Doctrine', APPPATH . 'libraries');
     $doctrineClassLoader->register();
     $entitiesClassLoader = new ClassLoader('models', rtrim(APPPATH, "/"));
     $entitiesClassLoader->register();
     $proxiesClassLoader = new ClassLoader('Proxies', APPPATH . 'models/proxies');
     $proxiesClassLoader->register();
     // Set up caches
     $config = new Configuration();
     $cache = new ArrayCache();
     $config->setMetadataCacheImpl($cache);
     $reader = new AnnotationReader();
     $driverImpl = new AnnotationDriver($reader, array(APPPATH . "models/Entities"));
     $config->setMetadataDriverImpl($driverImpl);
     $config->setQueryCacheImpl($cache);
     // Proxy configuration
     $config->setProxyDir(APPPATH . '/models/proxies');
     $config->setProxyNamespace('Proxies');
     $config->setAutoGenerateProxyClasses(true);
     AnnotationRegistry::registerLoader('class_exists');
     // Database connection information
     $connectionOptions = array('driver' => 'pdo_mysql', 'user' => $db['default']['username'], 'password' => $db['default']['password'], 'host' => $db['default']['hostname'], 'dbname' => $db['default']['database']);
     // Create EntityManager
     $this->em = EntityManager::create($connectionOptions, $config);
 }
开发者ID:richwandell,项目名称:Codeigniter-Example-App,代码行数:28,代码来源:Doctrine.php

示例10: loadDependencyDefaults

 public function loadDependencyDefaults(ContainerInterface $container)
 {
     // logger
     $container['logger'] = function (ContainerInterface $c) {
         $settings = $c->get('settings')['logger'];
         $debug = array_key_exists('debug', $settings) && $settings['debug'];
         $logger = new Logger($settings['name']);
         $logger->pushProcessor(new UidProcessor());
         $logger->pushHandler(new StreamHandler($settings['path'], $debug ? Logger::DEBUG : Logger::ERROR));
         return $logger;
     };
     // entity manager
     $container['entityManager'] = function (ContainerInterface $c) {
         $settings = $c->get('settings')['database'];
         $config = new Configuration();
         $config->setMetadataCacheImpl(new ArrayCache());
         $driverImpl = $config->newDefaultAnnotationDriver(array(__DIR__ . '/Entity'));
         $config->setMetadataDriverImpl($driverImpl);
         $config->setProxyDir(__DIR__ . '/Entity/Proxy');
         $config->setProxyNamespace('Proxy');
         return EntityManager::create($settings, $config);
     };
     $container['foundHandler'] = function () {
         return new RequestResponseArgs();
     };
     $container['dataFormatter'] = function () {
         return new ResponseDataFormatter();
     };
     return $container;
 }
开发者ID:vshvechko,项目名称:referaway,代码行数:30,代码来源:Configurator.php

示例11: _initDoctrine

 protected function _initDoctrine()
 {
     $config = new Configuration();
     switch (APPLICATION_ENV) {
         case 'production':
         case 'staging':
             $cache = new \Doctrine\Common\Cache\ApcCache();
             break;
             // Both development and test environments will use array cache.
         // Both development and test environments will use array cache.
         default:
             $cache = new \Doctrine\Common\Cache\ArrayCache();
             break;
     }
     $config->setMetadataCacheImpl($cache);
     $driverImpl = $config->newDefaultAnnotationDriver(APPLICATION_PATH . '/models');
     $config->setMetadataDriverImpl($driverImpl);
     $config->setQueryCacheImpl($cache);
     $config->setProxyDir(APPLICATION_PATH . '/proxies');
     $config->setProxyNamespace('D2Test\\Proxies');
     $options = $this->getOption('doctrine');
     $config->setAutoGenerateProxyClasses($options['auto_generate_proxy_class']);
     $em = EntityManager::create($options['db'], $config);
     Zend_Registry::set('EntityManager', $em);
     return $em;
 }
开发者ID:bzarzuela,项目名称:Doctrine-2-Blog-Example,代码行数:26,代码来源:Bootstrap.php

示例12: _initDoctrineEntityManager

 public function _initDoctrineEntityManager()
 {
     $this->bootstrap(array('classLoaders', 'doctrineCache'));
     $zendConfig = $this->getOptions();
     // parameters required for connecting to the database.
     // the required attributes are driver, host, user, password and dbname
     $connectionParameters = $zendConfig['doctrine']['connectionParameters'];
     // now initialize the configuration object
     $configuration = new DoctrineConfiguration();
     // the metadata cache is used to avoid parsing all mapping information every time
     // the framework is initialized.
     $configuration->setMetadataCacheImpl($this->getResource('doctrineCache'));
     // for performance reasons, it is also recommended to use a result cache
     $configuration->setResultCacheImpl($this->getResource('doctrineCache'));
     // if you set this option to true, Doctrine 2 will generate proxy classes for your entities
     // on the fly. This has of course impact on the performance and should therefore be disabled
     // in the production environment
     $configuration->setAutoGenerateProxyClasses($zendConfig['doctrine']['autoGenerateProxyClasses']);
     // the directory, where your proxy classes live
     $configuration->setProxyDir($zendConfig['doctrine']['proxyPath']);
     // the proxy classes' namespace
     $configuration->setProxyNamespace($zendConfig['doctrine']['proxyNamespace']);
     // the next option tells doctrine which description language we want to use for the mapping
     // information
     $driver = new YamlDriver($zendConfig['doctrine']['mappingPath']);
     $driver->setFileExtension('.yml');
     $configuration->setMetadataDriverImpl($driver);
     // next, we create an event manager
     $eventManager = new DoctrineEventManager();
     // now we have everything required to initialize the entity manager
     $entityManager = DoctrineEntityManager::create($connectionParameters, $configuration, $eventManager);
     Zend_Registry::set('em', $entityManager);
     return $entityManager;
 }
开发者ID:himel31,项目名称:doctrine2yml-zfmodules,代码行数:34,代码来源:Bootstrap.php

示例13: setUp

 protected function setUp()
 {
     $config = new Configuration();
     //$config->setHydratorDir(sys_get_temp_dir());
     //$config->setHydratorNamespace('Hydrators');
     $config->setProxyDir(sys_get_temp_dir());
     $config->setProxyNamespace('Proxies');
     $locatorXml = new SymfonyFileLocator(array(__DIR__ . '/../../../../../lib/Vespolina/Product/Mapping' => 'Vespolina\\Entity\\Product', __DIR__ . '/../../../../../vendor/vespolina/pricing/lib/Vespolina/Pricing/Mapping' => 'Vespolina\\Entity\\Pricing', __DIR__ . '/../../../../../vendor/vespolina/taxonomy/lib/Vespolina/Taxonomy/Mapping' => 'Vespolina\\Entity\\Taxonomy'), '.orm.xml');
     $drivers = new MappingDriverChain();
     $xmlDriver = new XmlDriver($locatorXml);
     $config->setMetadataDriverImpl($xmlDriver);
     $config->setMetadataCacheImpl(new ArrayCache());
     $config->setAutoGenerateProxyClasses(true);
     $eventManager = new EventManager();
     $treeListener = new TreeListener();
     $eventManager->addEventSubscriber($treeListener);
     $em = EntityManager::create(array('driver' => 'pdo_sqlite', 'path' => 'database.sqlite'), $config, $eventManager);
     $schemaTool = new \Doctrine\ORM\Tools\SchemaTool($em);
     $classes = array($em->getClassMetadata('Vespolina\\Entity\\Product\\Product'), $em->getClassMetadata('Vespolina\\Entity\\Taxonomy\\TaxonomyNode'));
     try {
         $schemaTool->dropSchema(array());
         $schemaTool->createSchema($classes);
     } catch (\Exception $e) {
     }
     $this->productGateway = new ProductDoctrineORMGateway($em, 'Vespolina\\Entity\\Product\\Product');
     $this->taxonomyGateway = new TaxonomyDoctrineORMGateway($em, 'Vespolina\\Entity\\Taxonomy\\TaxonomyNode');
     parent::setUp();
 }
开发者ID:vespolina,项目名称:commerce,代码行数:28,代码来源:ProductDoctrineORMGatewayTest.php

示例14: __construct

 public function __construct()
 {
     // load database configuration from CodeIgniter
     require_once APPPATH . 'config/database.php';
     // Set up class loading. You could use different autoloaders, provided by your favorite framework,
     // if you want to.
     //require_once APPPATH.'libraries/Doctrine/Common/ClassLoader.php';
     // We use the Composer Autoloader instead - just set
     // $config['composer_autoload'] = TRUE; in application/config/config.php
     //require_once APPPATH.'vendor/autoload.php';
     //A Doctrine Autoloader is needed to load the models
     $entitiesClassLoader = new ClassLoader('Entities', APPPATH . "models");
     $entitiesClassLoader->register();
     // Set up caches
     $config = new Configuration();
     $cache = new ArrayCache();
     $config->setMetadataCacheImpl($cache);
     $driverImpl = $config->newDefaultAnnotationDriver(array(APPPATH . 'models/Entities'));
     $config->setMetadataDriverImpl($driverImpl);
     $config->setQueryCacheImpl($cache);
     $config->setQueryCacheImpl($cache);
     // Proxy configuration
     $config->setProxyDir(APPPATH . '/models/proxies');
     $config->setProxyNamespace('Proxies');
     // Set up logger
     $logger = new EchoSQLLogger();
     $config->setSQLLogger($logger);
     $config->setAutoGenerateProxyClasses(TRUE);
     // Database connection information
     $connectionOptions = array('driver' => 'pdo_mysql', 'user' => 'dev_pila', 'password' => 'damienludothomas', 'host' => 'localhost', 'dbname' => 'tradr');
     // Create EntityManager
     $this->em = EntityManager::create($connectionOptions, $config);
 }
开发者ID:Thogusa,项目名称:Projet-Pila,代码行数:33,代码来源:Doctrine.php

示例15: getEntityManager

 /**
  * Get entity manager.
  *
  * @return EntityManagerInterface
  */
 protected function getEntityManager()
 {
     if (null === $this->entityManager) {
         $params = ['driver' => 'pdo_sqlite', 'memory' => true];
         $cache = new ArrayCache();
         /** @var AnnotationReader $reader */
         $reader = new CachedReader(new AnnotationReader(), $cache);
         $annotationDriver = new AnnotationDriver($reader, [__DIR__ . '/../../../src/ORM']);
         $driverChain = new MappingDriverChain();
         $driverChain->addDriver($annotationDriver, Commander::ENTITY_NAMESPACE);
         DoctrineExtensions::registerAbstractMappingIntoDriverChainORM($driverChain, $reader);
         $config = new Configuration();
         $config->setAutoGenerateProxyClasses(true);
         $config->setProxyDir(sys_get_temp_dir());
         $config->setProxyNamespace(Commander::ENTITY_NAMESPACE);
         $config->setMetadataDriverImpl($driverChain);
         $config->setMetadataCacheImpl($cache);
         $config->setQueryCacheImpl($cache);
         $config->setResultCacheImpl($cache);
         $config->setHydrationCacheImpl($cache);
         $timestampableListener = new TimestampableListener();
         $timestampableListener->setAnnotationReader($annotationDriver->getReader());
         $eventManager = new EventManager();
         $eventManager->addEventSubscriber($timestampableListener);
         $entityManager = EntityManager::create($params, $config, $eventManager);
         $schemaTool = new SchemaTool($entityManager);
         $schemaTool->createSchema($entityManager->getMetadataFactory()->getAllMetadata());
         $this->entityManager = $entityManager;
     }
     return $this->entityManager;
 }
开发者ID:gravitymedia,项目名称:commander,代码行数:36,代码来源:TaskEntityRepositoryTest.php


注:本文中的Doctrine\ORM\Configuration::setMetadataCacheImpl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。