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


PHP ClassLoader::setIncludePath方法代码示例

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


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

示例1: testClassLoader

 public function testClassLoader()
 {
     $classLoader = new ClassLoader('ClassLoaderTest');
     $classLoader->setIncludePath(__DIR__);
     $classLoader->setFileExtension('.class.php');
     $classLoader->setNamespaceSeparator('_');
     $this->assertEquals($classLoader->loadClass('ClassLoaderTest_ClassA'), true);
     $this->assertEquals($classLoader->loadClass('ClassLoaderTest_ClassB'), true);
     $this->assertEquals($classLoader->loadClass('ClassLoaderTest_ClassC'), true);
 }
开发者ID:jacques-sounvi,项目名称:addressbook,代码行数:10,代码来源:ClassLoaderTest.php

示例2: testMultipleAutoloadRequestsWillProduceSameResult

 public function testMultipleAutoloadRequestsWillProduceSameResult()
 {
     $classLoader = new ClassLoader();
     $classLoader->setIncludePath(__DIR__);
     $classLoader->setFileExtension('.class.php');
     $classLoader->setNamespaceSeparator('_');
     $this->assertTrue($classLoader->loadClass('ClassLoaderTest_ClassA'));
     $this->assertTrue($classLoader->loadClass('ClassLoaderTest_ClassA'));
 }
开发者ID:Dren-x,项目名称:mobitnew,代码行数:9,代码来源:ClassLoaderTest.php

示例3: _initDoctrine

 protected function _initDoctrine()
 {
     $appDoctrineConfig = $this->getOption('doctrine');
     $classLoader = new DoctrineClassLoader('Doctrine');
     $classLoader->setIncludePath(realpath(APPLICATION_PATH . '/../library'));
     $classLoader->register();
     $config = new DoctrineConfiguration();
     if (isset($appDoctrineConfig['cache'])) {
         switch ($appDoctrineConfig['cache']) {
             case 'array':
                 $cache = new DoctrineArrayCache();
                 break;
             case 'apc':
                 $cache = new DoctrineApcCache();
                 break;
         }
         $config->setQueryCacheImpl($cache);
         $config->setMetadataCacheImpl($cache);
     }
     $proxyDir = empty($appDoctrineConfig['proxyDir']) ? APPLICATION_PATH . '/../library/Orm/Proxies' : $appDoctrineConfig['proxyDir'];
     $config->setProxyDir(realpath($proxyDir));
     $config->setProxyNamespace('Orm\\Proxies');
     $config->setAutoGenerateProxyClasses(false);
     $config->setEntityNamespaces(array('Orm\\Entity'));
     $config->setMetadataDriverImpl(new \Doctrine\ORM\Mapping\Driver\StaticPHPDriver(realpath(APPLICATION_PATH . '/../library/Orm/Entity')));
     //$config->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger());
     $config->setSQLLogger(null);
     $db = $this->getResource('db');
     $dbConfig = $db->getConfig();
     $connectionOptions = array('pdo' => $db->getConnection(), 'dbname' => $dbConfig['dbname']);
     $entityManager = DoctrineEntityManager::create($connectionOptions, $config);
     $entityManager->getConnection()->getConfiguration()->setSQLLogger(null);
     Registry::setEntityManager($entityManager);
     return $entityManager;
 }
开发者ID:rukzuk,项目名称:rukzuk,代码行数:35,代码来源:Bootstrap.php


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