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


PHP Configuration::setProxyDir方法代码示例

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


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

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

示例2: testSetGetProxyDir

 public function testSetGetProxyDir()
 {
     $this->assertSame(null, $this->configuration->getProxyDir());
     // defaults
     $this->configuration->setProxyDir(__DIR__);
     $this->assertSame(__DIR__, $this->configuration->getProxyDir());
 }
开发者ID:pnaq57,项目名称:zf2demo,代码行数:7,代码来源:ConfigurationTest.php

示例3: setUp

 public function setUp()
 {
     $this->configuration = new Configuration();
     $this->configuration->setMetadataCacheImpl(new ArrayCache());
     $this->configuration->setQueryCacheImpl(new ArrayCache());
     $this->configuration->setProxyDir(__DIR__ . '/Proxies');
     $this->configuration->setProxyNamespace('DoctrineExtensions\\Tests\\Proxies');
     $this->configuration->setAutoGenerateProxyClasses(true);
     $this->configuration->setMetadataDriverImpl($this->configuration->newDefaultAnnotationDriver(__DIR__ . '/../Entities'));
     $this->entityManager = EntityManager::create(array('driver' => 'pdo_sqlite', 'memory' => true), $this->configuration);
 }
开发者ID:beberlei,项目名称:DoctrineExtensions,代码行数:11,代码来源:DbTestCase.php

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

示例5: _initDoctrineEntityManager

 public function _initDoctrineEntityManager()
 {
     $this->bootstrap(array('classLoaders'));
     $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
     $configuration->setMetadataDriverImpl($configuration->newDefaultAnnotationDriver($zendConfig['doctrine']['entityPath']));
     // 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:BillTheBest,项目名称:MetaNAS,代码行数:32,代码来源:Bootstrap.php

示例6: createEntityManager

 public static function createEntityManager($database)
 {
     $config = new Doctrine\ORM\Configuration();
     // annotations
     $annotationDriver = $config->newDefaultAnnotationDriver(array(APP_DIR . '/Model', NEURON_DIR . '/Model'));
     $config->setMetadataDriverImpl($annotationDriver);
     // proxy
     $config->setProxyNamespace('Neuron\\Proxy');
     $config->setProxyDir(TEMP_DIR);
     // cache
     $cache = Environment::isProduction() ? new NetteDoctrineCache() : new Doctrine\Common\Cache\ArrayCache();
     $config->setMetadataCacheImpl($cache);
     $config->setQueryCacheImpl($cache);
     // debugbar
     $config->setSQLLogger(Doctrine2Panel::getAndRegister());
     // entity manager
     $em = Doctrine\ORM\EntityManager::create((array) $database, $config);
     $evm = $em->getEventManager();
     $evm->addEventSubscriber(new Doctrine\DBAL\Event\Listeners\MysqlSessionInit("utf8", "utf8_czech_ci"));
     $evm->addEventSubscriber(new ValidationSubscriber());
     $evm->addEventSubscriber(new CacheSubscriber());
     $neonParser = new \Nette\NeonParser();
     $aliases = $neonParser->parse(file_get_contents(APP_DIR . "/entityClassAliases.neon"));
     $evm->addEventSubscriber(new \Neuron\Model\Doctrine\EntityClassAliasesSubscriber($aliases));
     return $em;
 }
开发者ID:janmarek,项目名称:Neuron,代码行数:26,代码来源:ServiceFactories.php

示例7: register

 public function register(Application $app)
 {
     //Load Doctrine Configuration
     $app['db.configuration'] = $app->share(function () use($app) {
         AnnotationRegistry::registerAutoloadNamespace("Doctrine\\ORM\\Mapping", __DIR__ . '/../../../../../doctrine/orm/lib');
         $config = new ORMConfiguration();
         $cache = $app['debug'] == false ? new ApcCache() : new ArrayCache();
         $config->setMetadataCacheImpl($cache);
         $config->setQueryCacheImpl($cache);
         $chain = new DriverChain();
         foreach ((array) $app['db.orm.entities'] as $entity) {
             switch ($entity['type']) {
                 case 'annotation':
                     $reader = new AnnotationReader();
                     $driver = new AnnotationDriver($reader, (array) $entity['path']);
                     $chain->addDriver($driver, $entity['namespace']);
                     break;
                     /*case 'yml':
                           $driver = new YamlDriver((array)$entity['path']);
                           $driver->setFileExtension('.yml');
                           $chain->addDriver($driver, $entity['namespace']);
                           break;
                       case 'xml':
                           $driver = new XmlDriver((array)$entity['path'], $entity['namespace']);
                           $driver->setFileExtension('.xml');
                           $chain->addDriver($driver, $entity['namespace']);
                           break;*/
                 /*case 'yml':
                       $driver = new YamlDriver((array)$entity['path']);
                       $driver->setFileExtension('.yml');
                       $chain->addDriver($driver, $entity['namespace']);
                       break;
                   case 'xml':
                       $driver = new XmlDriver((array)$entity['path'], $entity['namespace']);
                       $driver->setFileExtension('.xml');
                       $chain->addDriver($driver, $entity['namespace']);
                       break;*/
                 default:
                     throw new \InvalidArgumentException(sprintf('"%s" is not a recognized driver', $type));
                     break;
             }
         }
         $config->setMetadataDriverImpl($chain);
         $config->setProxyDir($app['db.orm.proxies_dir']);
         $config->setProxyNamespace($app['db.orm.proxies_namespace']);
         $config->setAutoGenerateProxyClasses($app['db.orm.auto_generate_proxies']);
         return $config;
     });
     //Set Defaut Configuration
     $defaults = array('entities' => array(array('type' => 'annotation', 'path' => 'Entity', 'namespace' => 'Entity')), 'proxies_dir' => 'cache/doctrine/Proxy', 'proxies_namespace' => 'DoctrineProxy', 'auto_generate_proxies' => true);
     foreach ($defaults as $key => $value) {
         if (!isset($app['db.orm.' . $key])) {
             $app['db.orm.' . $key] = $value;
         }
     }
     $self = $this;
     $app['db.orm.em'] = $app->share(function () use($self, $app) {
         return EntityManager::create($app['db'], $app['db.configuration']);
     });
 }
开发者ID:amenophis,项目名称:silex-doctrineorm,代码行数:60,代码来源:DoctrineORMServiceProvider.php

示例8: getConfiguration

 /**
  * getEntityManagerOptions
  *
  * Return the Doctrine ORM configuration instance 
  * 
  * @param array $options The options array
  * @return Doctrine\ORM\Configuration
  */
 protected function getConfiguration()
 {
     if (!isset($this->_config)) {
         $options = $this->getOptions();
         $config = new Configuration();
         $config->setProxyDir($options['proxydir']);
         if (APPLICATION_ENV == 'development') {
             $options['autogenerateproxies'] = true;
             $options['cache'] = 'array';
         }
         if (isset($options['cache'])) {
             $cache = $this->createCache($options['cache']);
             $config->setMetadataCacheImpl($cache);
             $config->setQueryCacheImpl($cache);
         }
         if (isset($options['proxynamespace'])) {
             $config->setProxyNamespace($options['proxynamespace']);
         }
         $config->setAutoGenerateProxyClasses(false);
         if (isset($options['autogenerateproxies']) && $options['autogenerateproxies']) {
             $config->setAutoGenerateProxyClasses(true);
         }
         $config->setMetadataDriverImpl($this->createMetadataDriver($options['metadatadriver'], $options['entitydir']));
         $this->_config = $config;
     }
     return $this->_config;
 }
开发者ID:alex-patterson-webdev,项目名称:multiverse,代码行数:35,代码来源:Entitymanager.php

示例9: createEntityManager

 /**
  * @return \Doctrine\ORM\EntityManager
  */
 protected function createEntityManager()
 {
     // event manager used to create schema before tests
     $eventManager = new EventManager();
     $eventManager->addEventListener(array("preTestSetUp"), new SchemaSetupListener());
     // doctrine xml configs and namespaces
     $configPathList = array();
     if (is_dir(__DIR__ . '/../Resources/config/doctrine')) {
         $dir = __DIR__ . '/../Resources/config/doctrine';
         $configPathList[] = $dir;
         $prefixList[$dir] = 'Kitpages\\DataGridBundle\\Entities';
     }
     if (is_dir(__DIR__ . '/_doctrine/config')) {
         $dir = __DIR__ . '/_doctrine/config';
         $configPathList[] = $dir;
         $prefixList[$dir] = 'Kitpages\\DataGridBundle\\Tests\\TestEntities';
     }
     // create drivers (that reads xml configs)
     $driver = new \Symfony\Bridge\Doctrine\Mapping\Driver\XmlDriver($configPathList);
     $driver->setNamespacePrefixes($prefixList);
     // create config object
     $config = new Configuration();
     $config->setMetadataCacheImpl(new ArrayCache());
     $config->setMetadataDriverImpl($driver);
     $config->setProxyDir(__DIR__ . '/TestProxies');
     $config->setProxyNamespace('Kitpages\\DataGridBundle\\Tests\\TestProxies');
     $config->setAutoGenerateProxyClasses(true);
     //$config->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger());
     // create entity manager
     $em = EntityManager::create(array('driver' => 'pdo_sqlite', 'path' => "/tmp/sqlite-test.db"), $config, $eventManager);
     return $em;
 }
开发者ID:radmar,项目名称:KitpagesDataGridBundle,代码行数:35,代码来源:BundleOrmTestCase.php

示例10: __construct

 public function __construct()
 {
     //cargamos la configuración de base de datos de codeigniter
     require APPPATH . "config/database.php";
     //utilizamos el namespace Entities para mapear el directorio models
     $entitiesClassLoader = new ClassLoader('Entities', rtrim(APPPATH . "models"));
     $entitiesClassLoader->register();
     //utilizamos el namespace Proxies para mapear el directorio models/proxies
     $proxiesClassLoader = new ClassLoader('Proxies', APPPATH . 'models/proxies');
     $proxiesClassLoader->register();
     // Configuración y chaché
     $config = new Configuration();
     $cache = new ArrayCache();
     $config->setMetadataCacheImpl($cache);
     $driverImpl = $config->newDefaultAnnotationDriver(array(APPPATH . 'models/entities'));
     $config->setMetadataDriverImpl($driverImpl);
     $config->setQueryCacheImpl($cache);
     $config->setQueryCacheImpl($cache);
     // Configuración Proxy
     $config->setProxyDir(APPPATH . '/models/proxies');
     $config->setProxyNamespace('Proxies');
     // Habilitar el logger para obtener información de cada proceso
     $logger = new EchoSQLLogger();
     //$config->setSQLLogger($logger);
     $config->setAutoGenerateProxyClasses(TRUE);
     //configuramos la conexión con la base de datos utilizando las credenciales de nuestra app
     $connectionOptions = array('driver' => 'pdo_mysql', 'user' => $db["default"]["username"], 'password' => $db["default"]["password"], 'host' => $db["default"]["hostname"], 'dbname' => $db["default"]["database"]);
     // Creamos el EntityManager
     $this->em = EntityManager::create($connectionOptions, $config);
 }
开发者ID:uno-de-piera,项目名称:doctrine-codeigniter3,代码行数:30,代码来源:Doctrine.php

示例11: __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

示例12: __construct

 public function __construct()
 {
     if (defined('FCPATH')) {
         //Get CI instance
         $this->ci = CI_Controller::get_instance();
         //Load database configuration from CodeIgniter
         $this->db = $this->ci->db;
         //Database connection information
         $connectionOptions = array('user' => $this->db->username, 'password' => $this->db->password, 'host' => $this->db->hostname, 'dbname' => $this->db->database);
     } elseif (ENVIRONMENT === 'development') {
         include_once str_replace("/", DIRECTORY_SEPARATOR, APPPATH) . 'config' . DIRECTORY_SEPARATOR . 'development' . DIRECTORY_SEPARATOR . 'database.php';
         $connectionOptions = array('user' => $db['default']['username'], 'password' => $db['default']['password'], 'host' => $db['default']['hostname'], 'dbname' => $db['default']['database']);
     }
     $connectionOptions['driver'] = 'pdo_mysql';
     $connectionOptions['charset'] = 'utf8';
     $connectionOptions['driverOptions'] = array(1002 => 'SET NAMES utf8');
     $config = new Configuration();
     //Set up caches
     $cache = new ArrayCache();
     $config->setMetadataCacheImpl($cache);
     $config->setQueryCacheImpl($cache);
     //Set up Annotation
     $driverImpl = $config->newDefaultAnnotationDriver(array(APPPATH . 'models/Entities'));
     $config->setMetadataDriverImpl($driverImpl);
     //Proxy configuration
     $config->setProxyDir(APPPATH . '/models/proxies');
     $config->setProxyNamespace('Proxies');
     $config->setAutoGenerateProxyClasses(TRUE);
     // Create EntityManager
     $this->em = EntityManager::create($connectionOptions, $config);
     //Fix the problem: "unknown database type enum requested"
     $platform = $this->em->getConnection()->getDatabasePlatform();
     $platform->registerDoctrineTypeMapping('enum', 'string');
 }
开发者ID:ricardoandrietta,项目名称:skeleton-ci,代码行数:34,代码来源:Doctrine.php

示例13: loadDependencyDefaults

 public function loadDependencyDefaults(ContainerInterface $container)
 {
     // logger
     $container['logger'] = function (ContainerInterface $c) {
         $settings = $c->get('settings')['logger'];
         $debug = array_key_exists('debug', $settings) && $settings['debug'];
         $logger = new Logger($settings['name']);
         $logger->pushProcessor(new UidProcessor());
         $logger->pushHandler(new StreamHandler($settings['path'], $debug ? Logger::DEBUG : Logger::ERROR));
         return $logger;
     };
     // entity manager
     $container['entityManager'] = function (ContainerInterface $c) {
         $settings = $c->get('settings')['database'];
         $config = new Configuration();
         $config->setMetadataCacheImpl(new ArrayCache());
         $driverImpl = $config->newDefaultAnnotationDriver(array(__DIR__ . '/Entity'));
         $config->setMetadataDriverImpl($driverImpl);
         $config->setProxyDir(__DIR__ . '/Entity/Proxy');
         $config->setProxyNamespace('Proxy');
         return EntityManager::create($settings, $config);
     };
     $container['foundHandler'] = function () {
         return new RequestResponseArgs();
     };
     $container['dataFormatter'] = function () {
         return new ResponseDataFormatter();
     };
     return $container;
 }
开发者ID:vshvechko,项目名称:referaway,代码行数:30,代码来源:Configurator.php

示例14: _initDoctrine

 protected function _initDoctrine()
 {
     $config = new Configuration();
     switch (APPLICATION_ENV) {
         case 'production':
         case 'staging':
             $cache = new \Doctrine\Common\Cache\ApcCache();
             break;
             // Both development and test environments will use array cache.
         // Both development and test environments will use array cache.
         default:
             $cache = new \Doctrine\Common\Cache\ArrayCache();
             break;
     }
     $config->setMetadataCacheImpl($cache);
     $driverImpl = $config->newDefaultAnnotationDriver(APPLICATION_PATH . '/models');
     $config->setMetadataDriverImpl($driverImpl);
     $config->setQueryCacheImpl($cache);
     $config->setProxyDir(APPLICATION_PATH . '/proxies');
     $config->setProxyNamespace('D2Test\\Proxies');
     $options = $this->getOption('doctrine');
     $config->setAutoGenerateProxyClasses($options['auto_generate_proxy_class']);
     $em = EntityManager::create($options['db'], $config);
     Zend_Registry::set('EntityManager', $em);
     return $em;
 }
开发者ID:bzarzuela,项目名称:Doctrine-2-Blog-Example,代码行数:26,代码来源:Bootstrap.php

示例15: setUp

 protected function setUp()
 {
     $config = new Configuration();
     //$config->setHydratorDir(sys_get_temp_dir());
     //$config->setHydratorNamespace('Hydrators');
     $config->setProxyDir(sys_get_temp_dir());
     $config->setProxyNamespace('Proxies');
     $locatorXml = new SymfonyFileLocator(array(__DIR__ . '/../../../../../lib/Vespolina/Product/Mapping' => 'Vespolina\\Entity\\Product', __DIR__ . '/../../../../../vendor/vespolina/pricing/lib/Vespolina/Pricing/Mapping' => 'Vespolina\\Entity\\Pricing', __DIR__ . '/../../../../../vendor/vespolina/taxonomy/lib/Vespolina/Taxonomy/Mapping' => 'Vespolina\\Entity\\Taxonomy'), '.orm.xml');
     $drivers = new MappingDriverChain();
     $xmlDriver = new XmlDriver($locatorXml);
     $config->setMetadataDriverImpl($xmlDriver);
     $config->setMetadataCacheImpl(new ArrayCache());
     $config->setAutoGenerateProxyClasses(true);
     $eventManager = new EventManager();
     $treeListener = new TreeListener();
     $eventManager->addEventSubscriber($treeListener);
     $em = EntityManager::create(array('driver' => 'pdo_sqlite', 'path' => 'database.sqlite'), $config, $eventManager);
     $schemaTool = new \Doctrine\ORM\Tools\SchemaTool($em);
     $classes = array($em->getClassMetadata('Vespolina\\Entity\\Product\\Product'), $em->getClassMetadata('Vespolina\\Entity\\Taxonomy\\TaxonomyNode'));
     try {
         $schemaTool->dropSchema(array());
         $schemaTool->createSchema($classes);
     } catch (\Exception $e) {
     }
     $this->productGateway = new ProductDoctrineORMGateway($em, 'Vespolina\\Entity\\Product\\Product');
     $this->taxonomyGateway = new TaxonomyDoctrineORMGateway($em, 'Vespolina\\Entity\\Taxonomy\\TaxonomyNode');
     parent::setUp();
 }
开发者ID:vespolina,项目名称:commerce,代码行数:28,代码来源:ProductDoctrineORMGatewayTest.php


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