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


PHP Configuration::setAutogenerateProxyClasses方法代碼示例

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


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

示例1: __construct

 public function __construct(array $dbConfig, array $options = array())
 {
     extract($options);
     $entityClassLoader = new ClassLoader("Entities", $entityPath);
     $entityClassLoader->register();
     $proxyPath = isset($proxyPath) ? $proxyPath : $entityPath;
     $proxyClassLoader = new ClassLoader("Proxies", $proxyPath);
     $proxyClassLoader->register();
     $config = new Configuration();
     if ($isDevMode || $isArrayCache) {
         $cache = new ArrayCache();
     } else {
         $cache = new ApcCache();
     }
     $config->setMetadataCacheImpl($cache);
     $config->setQueryCacheImpl($cache);
     $config->setProxyDir($proxyPath);
     $config->setProxyNamespace($namespaces["proxy"]);
     if (isset($isDevMode) && $isDevMode) {
         $config->setAutogenerateProxyClasses(true);
     }
     if (isset($driverClass) && class_exists($driverClass)) {
         $annotationDriver = new $driverClass($entity_driver);
     } else {
         $annotationDriver = new AnnotationDriver(new AnnotationReader(), array($entityPath));
         AnnotationRegistry::registerLoader('class_exists');
     }
     $config->setMetadataDriverImpl($annotationDriver);
     $this->setEntityManager($dbConfig, $config);
 }
開發者ID:Luyanda86,項目名稱:silex-playground,代碼行數:30,代碼來源:DoctrineService.php

示例2: register

 public function register(Application $app)
 {
     $app['doctrine_orm.configuration'] = $app->share(function ($app) {
         $configuration = new Configuration();
         if (isset($app['doctrine_orm.metadata_cache'])) {
             $configuration->setMetadataCacheImpl($app['doctrine_orm.metadata_cache']);
         } else {
             $configuration->setMetadataCacheImpl(new ArrayCache());
         }
         $driverImpl = $configuration->newDefaultAnnotationDriver($app['doctrine_orm.entities_path']);
         $configuration->setMetadataDriverImpl($driverImpl);
         if (isset($app['doctrine_orm.query_cache'])) {
             $configuration->setQueryCacheImpl($app['doctrine_orm.query_cache']);
         } else {
             $configuration->setQueryCacheImpl(new ArrayCache());
         }
         if (isset($app['doctrine_orm.result_cache'])) {
             $configuration->setResultCacheImpl($app['doctrine_orm.result_cache']);
         }
         $configuration->setProxyDir($app['doctrine_orm.proxies_path']);
         $configuration->setProxyNamespace($app['doctrine_orm.proxies_namespace']);
         $configuration->setAutogenerateProxyClasses(false);
         if (isset($app['doctrine_orm.autogenerate_proxy_classes'])) {
             $configuration->setAutogenerateProxyClasses($app['doctrine_orm.autogenerate_proxy_classes']);
         } else {
             $configuration->setAutogenerateProxyClasses(true);
         }
         return $configuration;
     });
     $app['doctrine_orm.connection'] = $app->share(function ($app) {
         return DriverManager::getConnection($app['doctrine_orm.connection_parameters'], $app['doctrine_orm.configuration'], new EventManager());
     });
     $app['doctrine_orm.em'] = $app->share(function ($app) {
         return EntityManager::create($app['doctrine_orm.connection'], $app['doctrine_orm.configuration'], $app['doctrine_orm.connection']->getEventManager());
     });
 }
開發者ID:scriptmage,項目名稱:sceneengine,代碼行數:36,代碼來源:DoctrineORMServiceProvider.php


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