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