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


PHP ClassLoader::getIncludePath方法代碼示例

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


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

示例1: __construct

 /**
  * constructor
  */
 public function __construct()
 {
     // load database configuration from CodeIgniter
     require APPPATH . 'config/database.php';
     // Set up class loading. You could use different autoloaders, provided by your favorite framework,
     // if you want to.
     //require_once APPPATH.'third_party/Doctrine/Common/ClassLoader.php';
     $doctrineClassLoader = new ClassLoader('Doctrine', APPPATH . '../vendor/doctrine');
     $doctrineClassLoader->register();
     $entitiesClassLoader = new ClassLoader('models', APPPATH . "models/Entities");
     $entitiesClassLoader->register();
     $proxiesClassLoader = new ClassLoader('proxies', APPPATH . 'models/proxies');
     $proxiesClassLoader->register();
     // Set up caches
     $config = new Configuration();
     //TODO this approach won't work always, developers may habe memcached installed, but not interested
     //to use or server not running. Need to fix.
     if (class_exists('Memcached')) {
         $memcache = new \Memcached();
         $memcache->addServer('127.0.0.1', 11211);
         $cacheDriver = new \Doctrine\Common\Cache\MemcachedCache();
         $cacheDriver->setMemcached($memcache);
     } else {
         if (extension_loaded('apc') && ini_get('apc.enabled')) {
             $cacheDriver = new \Doctrine\Common\Cache\ApcCache();
         } else {
             $cacheDriver = new \Doctrine\Common\Cache\ArrayCache();
         }
     }
     $config->setMetadataCacheImpl($cacheDriver);
     $driverImpl = $config->newDefaultAnnotationDriver(array(APPPATH . 'models/Entities'));
     $config->setMetadataDriverImpl($driverImpl);
     $config->setQueryCacheImpl($cacheDriver);
     // Proxy configuration
     $config->setProxyDir(APPPATH . 'models/proxies');
     $config->setProxyNamespace('Proxies');
     // Set up logger
     //$logger = new Doctrine\DBAL\Logging\CIProfiler();
     //$config->setSQLLogger($logger);
     $config->setAutoGenerateProxyClasses(TRUE);
     // Database connection information
     $connectionOptions = array('driver' => 'pdo_mysql', 'user' => $db['default']['username'], 'password' => $db['default']['password'], 'host' => $db['default']['hostname'], 'dbname' => $db['default']['database']);
     // Create EntityManager
     $this->em = EntityManager::create($connectionOptions, $config);
     foreach ($driverImpl->getAllClassNames() as $class) {
         require_once $entitiesClassLoader->getIncludePath() . "/" . $class . ".php";
     }
     //$this->generate_classes();
 }
開發者ID:csiber,項目名稱:codeigniterplus,代碼行數:52,代碼來源:doctrine.php

示例2: __construct

 /**
  * constructor
  */
 public function __construct()
 {
     // load database configuration from CodeIgniter
     require APPPATH . 'config/database.php';
     // Set up class loading. You could use different autoloaders, provided by your favorite framework,
     // if you want to.
     //require_once APPPATH.'third_party/Doctrine/Common/ClassLoader.php';
     $doctrineClassLoader = new ClassLoader('Doctrine', APPPATH . '../vendor/doctrine');
     $doctrineClassLoader->register();
     $entitiesClassLoader = new ClassLoader('models', APPPATH . "models/Entities");
     $entitiesClassLoader->register();
     $proxiesClassLoader = new ClassLoader('proxies', APPPATH . 'models/proxies');
     $proxiesClassLoader->register();
     // Set up caches
     $config = new Configuration();
     $cache = new ArrayCache();
     $config->setMetadataCacheImpl($cache);
     $driverImpl = $config->newDefaultAnnotationDriver(array(APPPATH . 'models/Entities'));
     $config->setMetadataDriverImpl($driverImpl);
     $config->setQueryCacheImpl($cache);
     // Proxy configuration
     $config->setProxyDir(APPPATH . 'models/proxies');
     $config->setProxyNamespace('Proxies');
     // Set up logger
     //$logger = new Doctrine\DBAL\Logging\CIProfiler();
     //$config->setSQLLogger($logger);
     $config->setAutoGenerateProxyClasses(TRUE);
     // Database connection information
     $connectionOptions = array('driver' => 'pdo_mysql', 'user' => $db['default']['username'], 'password' => $db['default']['password'], 'host' => $db['default']['hostname'], 'dbname' => $db['default']['database']);
     // Create EntityManager
     $this->em = EntityManager::create($connectionOptions, $config);
     foreach ($driverImpl->getAllClassNames() as $class) {
         require_once $entitiesClassLoader->getIncludePath() . "/" . $class . ".php";
     }
     //$this->generate_classes();
 }
開發者ID:benfuller,項目名稱:codeigniterplus,代碼行數:39,代碼來源:doctrine.php


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