本文整理汇总了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();
}
示例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;
}
示例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();
}