CodeIgniter2的Doctrine2包装器-开发配置。
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CodeIgniter2的Doctrine2包装器-开发配置。相关的知识,希望对你有一定的参考价值。
<?php use DoctrineCommonClassLoader, DoctrineORMConfiguration, DoctrineORMEntityManager, DoctrineCommonCacheArrayCache, DoctrineDBALLoggingEchoSQLLogger; class Doctrine { public $em = null; public function __construct() { // load database configuration from CodeIgniter require_once 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.'libraries/Doctrine/Common/ClassLoader.php'; $doctrineClassLoader = new ClassLoader('Doctrine', APPPATH.'libraries'); $doctrineClassLoader->register(); $entitiesClassLoader->register(); $proxiesClassLoader = new ClassLoader('Proxies', APPPATH.'models/proxies'); $proxiesClassLoader->register(); // Set up caches $config = new Configuration; $cache = new ArrayCache; $config->setMetadataCacheImpl($cache); $config->setMetadataDriverImpl($driverImpl); $config->setQueryCacheImpl($cache); $config->setQueryCacheImpl($cache); // Proxy configuration $config->setProxyDir(APPPATH.'/models/proxies'); $config->setProxyNamespace('Proxies'); // Set up logger $logger = new EchoSQLLogger; $config->setSQLLogger($logger); $config->setAutoGenerateProxyClasses( TRUE ); // Database connection information 'user' => $db['default']['username'], 'password' => $db['default']['password'], 'host' => $db['default']['hostname'], 'dbname' => $db['default']['database'] ); // Create EntityManager $this->em = EntityManager::create($connectionOptions, $config); } }
以上是关于CodeIgniter2的Doctrine2包装器-开发配置。的主要内容,如果未能解决你的问题,请参考以下文章
Codeigniter2,Doctrine2,作曲家等。一个巨大的混乱
PHP cli-config.php - doctrine2 + codeigniter2
在 Doctrine 2 / CodeIgniter 2 中找不到实体模型