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


PHP Configuration::ensureProductionSettings方法代码示例

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


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

示例1: testEnsureProductionSettingsAutoGenerateProxyClassesEval

 public function testEnsureProductionSettingsAutoGenerateProxyClassesEval()
 {
     $this->setProductionSettings();
     $this->configuration->setAutoGenerateProxyClasses(AbstractProxyFactory::AUTOGENERATE_EVAL);
     $this->setExpectedException('Doctrine\\ORM\\ORMException', 'Proxy Classes are always regenerating.');
     $this->configuration->ensureProductionSettings();
 }
开发者ID:selimcr,项目名称:servigases,代码行数:7,代码来源:ConfigurationTest.php

示例2: manufacture

 /**
  * Manufactures an EntityManager instance using the passed configuration.
  *
  * @param array|Connection		$conn
  * @param Cache					$cache_driver
  * @param Reader				$annotation_reader
  * @param array					$entity_paths
  * @param boolean				[$autogenerate_strategy]
  * @param boolean				[$ensure_production_settings]
  * @param string				[$doctrine_annotations_file_path]
  * @param string				[$proxy_namespace]
  * @param string				[$proxy_dir]
  *
  * @throws Exception
  *
  * @return EntityManager
  */
 public static function manufacture($conn, Cache $cache_driver, Reader $annotation_reader, array $entity_paths, $autogenerate_strategy = false, $ensure_production_settings = false, $doctrine_annotations_file_path = self::DOCTRINE_ANNOTATIONS_FILE_PATH, $proxy_namespace = "Doctrine\\Proxies", $proxy_dir = "/lib/src/Doctrine/Proxies")
 {
     # Let the IDE know that the annotation reader is of the expected type
     /** @var AnnotationReader $annotation_reader */
     $config = new Configuration();
     # Set up the Metadata Cache implementation -- this caches the scraped Metadata Configuration (i.e. the Annotations/XML/YAML) values
     # !!!WARNING!!! If using MemCache - Doctrine does NOT throw an error if it can't connect to MemCache, it just silently goes on without a cache.
     # Always check to see if the cache is being populated ($cache_driver -> getStats())
     $config->setMetadataCacheImpl($cache_driver);
     # Register the Annotation handle file
     # See http://doctrine-common.readthedocs.org/en/latest/reference/annotations.html for details
     AnnotationRegistry::registerFile($doctrine_annotations_file_path);
     # Set up the Metadata Driver implementation -- this tells Doctrine where to find the Annotated PHP classes to form Entities
     $config->setMetadataDriverImpl(new AnnotationDriver($annotation_reader, $entity_paths));
     # Set up the Query Cache implementation -- this caches DQL query transformations into plain SQL
     $config->setQueryCacheImpl($cache_driver);
     # Set up the Proxy directory where Doctrine will store Proxy classes, and the namespace they will have
     $config->setProxyDir($proxy_dir);
     $config->setProxyNamespace($proxy_namespace);
     # Configure proxy generation
     $config->setAutoGenerateProxyClasses($autogenerate_strategy);
     # Test production settings if desired
     if ($ensure_production_settings) {
         $config->ensureProductionSettings();
     }
     # If connection is just the raw details for the moment, generate the real deal now
     if (is_array($conn)) {
         $conn = DriverManager::getConnection($conn, $config);
     }
     # Create the Entity Manager with the DB config details and ORM Config values
     $em = EntityManager::create($conn, $config);
     # Define our handy-dandy UTC Date Time column type
     if (!Type::hasType("utcdatetime")) {
         Type::addType("utcdatetime", "PorkChopSandwiches\\Doctrine\\Utilities\\Types\\UTCDateTimeType");
         $em->getConnection()->getDatabasePlatform()->registerDoctrineTypeMapping("datetime", "utcdatetime");
     }
     return $em;
 }
开发者ID:porkchopsandwiches,项目名称:doctrine-utilities,代码行数:55,代码来源:Generator.php

示例3: ensureProductionSettings

 public function ensureProductionSettings()
 {
     $cache = $this->getMock('Doctrine\\Common\\Cache\\Cache');
     $this->configuration->setAutoGenerateProxyClasses(true);
     try {
         $this->configuration->ensureProductionSettings();
         $this->fail('Didn\'t check all production settings');
     } catch (ORMException $e) {
     }
     $this->configuration->setQueryCacheImpl($cache);
     try {
         $this->configuration->ensureProductionSettings();
         $this->fail('Didn\'t check all production settings');
     } catch (ORMException $e) {
     }
     $this->configuration->setMetadataCacheImpl($cache);
     try {
         $this->configuration->ensureProductionSettings();
         $this->fail('Didn\'t check all production settings');
     } catch (ORMException $e) {
     }
     $this->configuration->setAutoGenerateProxyClasses(false);
     $this->configuration->ensureProductionSettings();
 }
开发者ID:pnaq57,项目名称:zf2demo,代码行数:24,代码来源:ConfigurationTest.php


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