當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Configuration::setResultCacheImpl方法代碼示例

本文整理匯總了PHP中Doctrine\ORM\Configuration::setResultCacheImpl方法的典型用法代碼示例。如果您正苦於以下問題:PHP Configuration::setResultCacheImpl方法的具體用法?PHP Configuration::setResultCacheImpl怎麽用?PHP Configuration::setResultCacheImpl使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Doctrine\ORM\Configuration的用法示例。


在下文中一共展示了Configuration::setResultCacheImpl方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __invoke

 /**
  * @param  ContainerInterface $container
  * @return EntityManager
  */
 public function __invoke(ContainerInterface $container)
 {
     $config = $container->has('config') ? $container->get('config') : [];
     if (!isset($config['doctrine'])) {
         throw new ServiceNotCreatedException('Missing Doctrine configuration');
     }
     $config = $config['doctrine'];
     $proxyDir = isset($config['proxy_dir']) ? $config['proxy_dir'] : 'data/DoctrineORM/Proxy';
     $proxyNamespace = isset($config['proxy_namespace']) ? $config['proxy_namespace'] : 'DoctrineORM/Proxy';
     $autoGenerateProxyClasses = isset($config['configuration']['auto_generate_proxy_classes']) ? $config['configuration']['auto_generate_proxy_classes'] : false;
     $underscoreNamingStrategy = isset($config['configuration']['underscore_naming_strategy']) ? $config['configuration']['underscore_naming_strategy'] : false;
     // Doctrine ORM
     $doctrine = new Configuration();
     $doctrine->setProxyDir($proxyDir);
     $doctrine->setProxyNamespace($proxyNamespace);
     $doctrine->setAutoGenerateProxyClasses($autoGenerateProxyClasses);
     // Naming Strategy
     if ($underscoreNamingStrategy) {
         $doctrine->setNamingStrategy(new UnderscoreNamingStrategy());
     }
     // ORM mapping by Annotation
     //AnnotationRegistry::registerAutoloadNamespace($config['driver']['annotations']['class']);
     AnnotationRegistry::registerFile('vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php');
     $driver = new AnnotationDriver(new AnnotationReader(), $config['driver']['annotations']['paths']);
     $doctrine->setMetadataDriverImpl($driver);
     // Cache
     $cache = $container->get(\Doctrine\Common\Cache\Cache::class);
     $doctrine->setQueryCacheImpl($cache);
     $doctrine->setResultCacheImpl($cache);
     $doctrine->setMetadataCacheImpl($cache);
     // EntityManager
     return EntityManager::create($config['connection']['orm_default']['params'], $doctrine);
 }
開發者ID:vasildakov,項目名稱:expressive-doctrine-orm,代碼行數:37,代碼來源:DoctrineFactory.php

示例2: setDoctrineCache

 /**
  * Setup doctrine cache
  *
  * @return void
  */
 protected function setDoctrineCache()
 {
     static::$cacheDriver = static::getCacheDriverByOptions(\XLite::getInstance()->getOptions('cache'));
     $this->configuration->setMetadataCacheImpl(static::$cacheDriver);
     $this->configuration->setQueryCacheImpl(static::$cacheDriver);
     $this->configuration->setResultCacheImpl(static::$cacheDriver);
 }
開發者ID:kingsj,項目名稱:core,代碼行數:12,代碼來源:Database.php

示例3: 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

示例4: obterConfiguracao

 private function obterConfiguracao($dados)
 {
     $this->config = new Configuration();
     // Definição do driver de mapeamento
     $metadata_driver = "Doctrine\\ORM\\Mapping\\Driver\\{$dados['metadata_driver']}";
     if ($dados['metadata_driver'] == "AnnotationDriver") {
         $driver = $this->config->newDefaultAnnotationDriver(array(MODELO), true);
     } else {
         $driver = new $metadata_driver(CONFIG . DS . 'orm');
     }
     if (!empty($dados['map_paths'])) {
         $driver->addPaths(preg_split('/, ?/', $dados['map_paths']));
     }
     $this->config->setMetadataDriverImpl($driver);
     // Configurações de proxies
     $this->config->setProxyDir(RAIZ . DS . $dados['proxy_dir']);
     $this->config->setProxyNamespace($dados['proxy_namespace']);
     $this->config->setAutoGenerateProxyClasses($dados['auto_proxies']);
     // Definição da estratégia de caches de consultas e metadados
     $metadata_cache = "Doctrine\\Common\\Cache\\{$dados['metadata_cache']}";
     $query_cache = "Doctrine\\Common\\Cache\\{$dados['query_cache']}";
     $result_cache = "Doctrine\\Common\\Cache\\{$dados['query_cache']}";
     $this->config->setMetadataCacheImpl(new $metadata_cache());
     $this->config->setQueryCacheImpl(new $query_cache());
     $this->config->setResultCacheImpl(new $result_cache());
     // Ferramenta de log de consultas
     if (!empty($dados['sql_logger'])) {
         $sql_logger = "Doctrine\\DBAL\\Logging\\{$dados['sql_logger']}";
         $logger = new $sql_logger();
         $this->config->setSQLLogger($logger);
     }
 }
開發者ID:jjaferson,項目名稱:ourives,代碼行數:32,代碼來源:DoctrinePlugin.php

示例5: createService

 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     /** @var $options \DoctrineORMModule\Options\Configuration */
     $options = $this->getOptions($serviceLocator);
     $config = new Configuration();
     $config->setAutoGenerateProxyClasses($options->getGenerateProxies());
     $config->setProxyDir($options->getProxyDir());
     $config->setProxyNamespace($options->getProxyNamespace());
     $config->setEntityNamespaces($options->getEntityNamespaces());
     $config->setCustomDatetimeFunctions($options->getDatetimeFunctions());
     $config->setCustomStringFunctions($options->getStringFunctions());
     $config->setCustomNumericFunctions($options->getNumericFunctions());
     $config->setClassMetadataFactoryName($options->getClassMetadataFactoryName());
     foreach ($options->getNamedQueries() as $name => $query) {
         $config->addNamedQuery($name, $query);
     }
     foreach ($options->getNamedNativeQueries() as $name => $query) {
         $config->addNamedNativeQuery($name, $query['sql'], new $query['rsm']());
     }
     foreach ($options->getCustomHydrationModes() as $modeName => $hydrator) {
         $config->addCustomHydrationMode($modeName, $hydrator);
     }
     foreach ($options->getFilters() as $name => $class) {
         $config->addFilter($name, $class);
     }
     $config->setMetadataCacheImpl($serviceLocator->get($options->getMetadataCache()));
     $config->setQueryCacheImpl($serviceLocator->get($options->getQueryCache()));
     $config->setResultCacheImpl($serviceLocator->get($options->getResultCache()));
     $config->setHydrationCacheImpl($serviceLocator->get($options->getHydrationCache()));
     $config->setMetadataDriverImpl($serviceLocator->get($options->getDriver()));
     if ($namingStrategy = $options->getNamingStrategy()) {
         if (is_string($namingStrategy)) {
             if (!$serviceLocator->has($namingStrategy)) {
                 throw new InvalidArgumentException(sprintf('Naming strategy "%s" not found', $namingStrategy));
             }
             $config->setNamingStrategy($serviceLocator->get($namingStrategy));
         } else {
             $config->setNamingStrategy($namingStrategy);
         }
     }
     if ($repositoryFactory = $options->getRepositoryFactory()) {
         if (is_string($repositoryFactory)) {
             if (!$serviceLocator->has($repositoryFactory)) {
                 throw new InvalidArgumentException(sprintf('Repository factory "%s" not found', $repositoryFactory));
             }
             $config->setRepositoryFactory($serviceLocator->get($repositoryFactory));
         } else {
             $config->setRepositoryFactory($repositoryFactory);
         }
     }
     if ($entityListenerResolver = $options->getEntityListenerResolver()) {
         if ($entityListenerResolver instanceof EntityListenerResolver) {
             $config->setEntityListenerResolver($entityListenerResolver);
         } else {
             $config->setEntityListenerResolver($serviceLocator->get($entityListenerResolver));
         }
     }
     $this->setupDBALConfiguration($serviceLocator, $config);
     return $config;
 }
開發者ID:OnlineBidder,項目名稱:onlineBidder,代碼行數:60,代碼來源:ConfigurationFactory.php

示例6: _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

示例7: setDoctrineCache

 /**
  * Setup doctrine cache
  *
  * @return void
  */
 protected function setDoctrineCache()
 {
     static::$cacheDriver = new \XLite\Core\Cache();
     $driver = static::$cacheDriver->getDriver();
     $this->configuration->setMetadataCacheImpl($driver);
     $this->configuration->setQueryCacheImpl($driver);
     $this->configuration->setResultCacheImpl($driver);
 }
開發者ID:kirkbauer2,項目名稱:kirkxc,代碼行數:13,代碼來源:Database.php

示例8: setUp

 public function setUp()
 {
     $configuration = new Configuration();
     $configuration->setResultCacheImpl(new \Doctrine\Common\Cache\ArrayCache());
     $configuration->setMetadataDriverImpl(new \Doctrine\ORM\Mapping\Driver\AnnotationDriver(new AnnotationReader(), realpath(__DIR__ . '/Models/')));
     $connection = \Doctrine\DBAL\DriverManager::getConnection(array('driver' => $GLOBALS['db_type'], 'host' => $GLOBALS['db_host'], 'dbname' => $GLOBALS['db_name'], 'user' => $GLOBALS['db_username'], 'password' => $GLOBALS['db_password']));
     $configuration->setMetadataCacheImpl(new \Doctrine\Common\Cache\ZendDataCache());
     $this->em = new \Lynx\EntityManager($connection, $configuration);
 }
開發者ID:lynx,項目名稱:lynx,代碼行數:9,代碼來源:TestCase.php

示例9: create

 public function create()
 {
     $debug = $this->options['debug'];
     $doctrineConfig = new Configuration();
     $doctrineConfig->setMetadataCacheImpl($this->cache);
     $doctrineConfig->setMetadataDriverImpl($this->driver);
     $doctrineConfig->setQueryCacheImpl($this->cache);
     $doctrineConfig->setResultCacheImpl($this->cache);
     $doctrineConfig->setProxyDir($this->options['proxy_dir']);
     $doctrineConfig->setProxyNamespace($this->options['proxy_namespace']);
     $doctrineConfig->setAutoGenerateProxyClasses($debug);
     return $doctrineConfig;
 }
開發者ID:elfet,項目名稱:silicone,代碼行數:13,代碼來源:ConfigurationFactory.php

示例10: __invoke

 /**
  * @param ContainerInterface $container
  *
  * @return EntityManagerInterface
  * @throws ORMException
  */
 public function __invoke(ContainerInterface $container)
 {
     $config = $container->has('config') ? $container->get('config') : [];
     $proxyDir = isset($config['doctrine']['orm']['proxy_dir']) ? $config['doctrine']['orm']['proxy_dir'] : 'data/cache/EntityProxy';
     $proxyNamespace = isset($config['doctrine']['orm']['proxy_namespace']) ? $config['doctrine']['orm']['proxy_namespace'] : 'EntityProxy';
     $autoGenerateProxyClasses = isset($config['doctrine']['orm']['auto_generate_proxy_classes']) ? $config['doctrine']['orm']['auto_generate_proxy_classes'] : false;
     $underscoreNamingStrategy = isset($config['doctrine']['orm']['underscore_naming_strategy']) ? $config['doctrine']['orm']['underscore_naming_strategy'] : false;
     $entityPaths = isset($config['doctrine']['orm']['entity_paths']) ? $config['doctrine']['orm']['entity_paths'] : ['src'];
     // Doctrine ORM
     $doctrine = new Configuration();
     $doctrine->setProxyDir($proxyDir);
     $doctrine->setProxyNamespace($proxyNamespace);
     $doctrine->setAutoGenerateProxyClasses($autoGenerateProxyClasses);
     if ($underscoreNamingStrategy) {
         $doctrine->setNamingStrategy(new UnderscoreNamingStrategy());
     }
     // Cache
     $cache = $container->get(Cache::class);
     $doctrine->setQueryCacheImpl($cache);
     $doctrine->setResultCacheImpl($cache);
     $doctrine->setMetadataCacheImpl($cache);
     // ORM mapping by Annotation
     AnnotationRegistry::registerFile('vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php');
     if (class_exists(DoctrineExtensions::class)) {
         DoctrineExtensions::registerAnnotations();
     }
     $cachedAnnotationReader = new CachedReader(new AnnotationReader(), $cache);
     $driver = new AnnotationDriver($cachedAnnotationReader, $entityPaths);
     $doctrine->setMetadataDriverImpl($driver);
     $eventManager = new EventManager();
     if (isset($config['doctrine']['orm']['event_subscribers'])) {
         foreach ($config['doctrine']['orm']['event_subscribers'] as $subscriber) {
             $subscriberInstance = $container->get($subscriber);
             if ($subscriberInstance instanceof MappedEventSubscriber) {
                 $subscriberInstance->setAnnotationReader($cachedAnnotationReader);
             }
             $eventManager->addEventSubscriber($subscriberInstance);
         }
     }
     $entityManager = EntityManager::create($config['doctrine']['connection']['orm_default'], $doctrine, $eventManager);
     // Types
     Type::addType('uuid', UuidType::class);
     $entityManager->getConnection()->getDatabasePlatform()->registerDoctrineTypeMapping('uuid', 'uuid');
     if (isset($config['doctrine']['orm']['types'])) {
         foreach ($config['doctrine']['orm']['types'] as $type => $class) {
             Type::addType($type, $class);
         }
     }
     return $entityManager;
 }
開發者ID:oqq,項目名稱:ci-doctrine-factory,代碼行數:56,代碼來源:DoctrineEntityManagerFactory.php

示例11: init

 /**
  * Initializes resource
  *
  * @return Doctrine\ORM\EntityManager
  */
 public function init()
 {
     $options = $this->getOptions();
     $config = new Configuration();
     if (APPLICATION_ENV == 'production' && function_exists('apc_fetch')) {
         // @codeCoverageIgnoreStart
         #extension_loaded() memcache, xcache, redis
         $cache = new ApcCache();
     } else {
         // @codeCoverageIgnoreEnd
         $cache = new ArrayCache();
     }
     #$driverImpl = $config->newDefaultAnnotationDriver($options['modelDirectory']);
     // @todo Temporary(?) fix for using new AnnotationReader
     $reader = new AnnotationReader();
     #$reader->setEnableParsePhpImports(true);
     $reader = new IndexedReader($reader);
     $reader = new CachedReader($reader, $cache);
     $driverImpl = new AnnotationDriver($reader, $options['modelDirectory']);
     class_exists('Doctrine\\ORM\\Mapping\\Driver\\DoctrineAnnotations');
     // Beware cache slams: http://doctrine-orm.readthedocs.org/en/2.0.x/reference/caching.html#cache-slams
     $config->setMetadataCacheImpl($cache);
     $config->setQueryCacheImpl($cache);
     $config->setResultCacheImpl($cache);
     $config->setProxyDir($options['proxyDirectory']);
     $config->setProxyNamespace($options['proxyNamespace']);
     $config->setAutoGenerateProxyClasses($options['autoGenerateProxyClasses']);
     $config->setMetadataDriverImpl($driverImpl);
     // @codeCoverageIgnoreStart
     if (null !== $options['logPath']) {
         $sqlLogger = new SqlLogger($options['logPath']);
         $config->setSQLLogger($sqlLogger);
         Zend_Registry::set('sqlLogger', $sqlLogger);
     }
     // @codeCoverageIgnoreEnd
     $entityManager = EntityManager::create($options['connection'], $config);
     Service::setEntityManager($entityManager);
     // Add BLOB data type mapping
     if (!Type::hasType('gzblob')) {
         Type::addType('gzblob', 'Rexmac\\Zyndax\\Doctrine\\DBAL\\Type\\GzBlob');
         $entityManager->getConnection()->getDatabasePlatform()->registerDoctrineTypeMapping('BLOB', 'gzblob');
     }
     // Add IP data type mapping
     if (!Type::hasType('ip')) {
         Type::addType('ip', 'Rexmac\\Zyndax\\Doctrine\\DBAL\\Type\\Ip');
         $entityManager->getConnection()->getDatabasePlatform()->registerDoctrineTypeMapping('IP', 'ip');
     }
     return $entityManager;
 }
開發者ID:rexmac,項目名稱:zyndax,代碼行數:54,代碼來源:Doctrine.php

示例12: _initDoctrine

 public function _initDoctrine()
 {
     $classLoader = new ClassLoader('Doctrine');
     $classLoader->register();
     $config = new Configuration();
     $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache());
     $config->setResultCacheImpl(new \Doctrine\Common\Cache\ArrayCache());
     $driverImpl = $config->newDefaultAnnotationDriver('/home/jsuggs/bbm/BBM');
     $config->setMetadataDriverImpl($driverImpl);
     $config->setProxyDir(PROXYDIR);
     $config->setProxyNamespace('DoctrineProxies');
     $connectionOptions = array('driver' => 'pdo_pgsql', 'user' => 'bbm', 'password' => 'bbm', 'host' => 'localhost', 'dbname' => 'bbm');
     $em = EntityManager::create($connectionOptions, $config);
     return $em;
 }
開發者ID:jsuggs,項目名稱:BBM_old,代碼行數:15,代碼來源:Bootstrap.php

示例13: getDoctrine_ConfigService

 /**
  * @return \Doctrine\ORM\Configuration
  */
 protected function getDoctrine_ConfigService()
 {
     $this->services['doctrine.config'] = $instance = new Configuration();
     $baseDir = $this->getParameter('app.baseDir');
     $cache = $this->get('app.cache');
     $instance->setMetadataCacheImpl($cache);
     $instance->setQueryCacheImpl($cache);
     $instance->setResultCacheImpl($cache);
     $instance->setProxyDir($baseDir . $this->getParameter('doctrine.proxy.dir'));
     $instance->setProxyNamespace($this->getParameter('doctrine.proxy.namespace'));
     $instance->setAutoGenerateProxyClasses($this->getParameter('app.devmode'));
     AnnotationRegistry::registerFile($baseDir . 'vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php');
     $reader = new SimpleAnnotationReader();
     $reader->addNamespace('Doctrine\\ORM\\Mapping');
     $instance->setMetadataDriverImpl(new AnnotationDriver(new CachedReader($reader, $cache), array($baseDir . $this->getParameter('doctrine.entity.dir'))));
     return $instance;
 }
開發者ID:scdevsummit,項目名稱:phpsc-conf,代碼行數:20,代碼來源:Container.php

示例14: __construct

 public function __construct()
 {
     $config = ConfigReader::readConfig('doctrine');
     $doctrineConfig = new Configuration();
     $cache = new Cache();
     $doctrineConfig->setQueryCacheImpl($cache);
     $doctrineConfig->setProxyDir($config['proxyDir']);
     $doctrineConfig->setProxyNamespace('Proxy');
     $doctrineConfig->setAutoGenerateProxyClasses(true);
     $doctrineConfig->setResultCacheImpl($cache);
     //mapping (example uses annotations, could be any of XML/YAML or plain PHP)
     AnnotationRegistry::registerFile(BASE_DIR . '/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php');
     $driver = new \Doctrine\ORM\Mapping\Driver\AnnotationDriver(new \Doctrine\Common\Annotations\AnnotationReader(), array($config['entityDir']));
     $doctrineConfig->setMetadataDriverImpl($driver);
     $doctrineConfig->setMetadataCacheImpl($cache);
     $em = EntityManager::create($config, $doctrineConfig);
     $this->setEm($em);
 }
開發者ID:sandriq,項目名稱:blog,代碼行數:18,代碼來源:EntityManagerObject.php

示例15: initORM

 private function initORM()
 {
     $config_pff = ServiceContainer::get('config');
     if (true === $config_pff->getConfigData('development_environment')) {
         $cache = new ArrayCache();
     } elseif ($this->redis) {
         $redis = new \Redis();
         if (!$redis->connect($this->redis_host, $this->redis_port)) {
             throw new PffException("Cannot connect to redis", 500);
         }
         if ($this->redis_password != '') {
             if (!$redis->auth($this->redis_password)) {
                 throw new PffException("Cannot auth to redis", 500);
             }
         }
         $cache = new RedisCache();
         $cache->setRedis($redis);
         $cache->setNamespace($this->_app->getConfig()->getConfigData('app_name'));
     } else {
         $cache = new ApcuCache();
         $cache->setNamespace($this->_app->getConfig()->getConfigData('app_name'));
     }
     $config = new Configuration();
     $config->setMetadataCacheImpl($cache);
     $config->setQueryCacheImpl($cache);
     $config->setResultCacheImpl($cache);
     $driverImpl = $config->newDefaultAnnotationDriver(ROOT . DS . 'app' . DS . 'models');
     $config->setMetadataDriverImpl($driverImpl);
     $config->setQueryCacheImpl($cache);
     $config->setProxyDir(ROOT . DS . 'app' . DS . 'proxies');
     $config->setProxyNamespace('pff\\proxies');
     if (true === $config_pff->getConfigData('development_environment')) {
         $config->setAutoGenerateProxyClasses(true);
         $connectionOptions = $config_pff->getConfigData('databaseConfigDev');
     } else {
         $config->setAutoGenerateProxyClasses(false);
         $connectionOptions = $config_pff->getConfigData('databaseConfig');
     }
     $this->db = EntityManager::create($connectionOptions, $config);
     ServiceContainer::set()['dm'] = $this->db;
     $platform = $this->db->getConnection()->getDatabasePlatform();
     $platform->registerDoctrineTypeMapping('enum', 'string');
 }
開發者ID:stonedz,項目名稱:pff2-doctrine,代碼行數:43,代碼來源:Pff2Doctrine.php


注:本文中的Doctrine\ORM\Configuration::setResultCacheImpl方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。