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