コード例 #1
0
ファイル: MyEntityManagerFactory.php プロジェクト: jay45/porn
 private static function createNewEntityManager()
 {
     $config = new Configuration();
     $driverImpl = $config->newDefaultAnnotationDriver(APPLICATION_PATH . '/Models/Entities');
     $config->setMetadataDriverImpl($driverImpl);
     // 		$config->setMetadataCacheImpl(MyCache::getInstance("_doctrine_metadata")->getCacheImplement());
     // 		$config->setQueryCacheImpl(MyCache::getInstance("_doctrine_query_cache")->getCacheImplement());
     // 		$config->setResultCacheImpl(MyCache::getInstance("_doctrine_result_cache")->getCacheImplement());
     // 		$config->setHydrationCacheImpl(MyCache::getInstance("_doctrine_hydration_cache")->getCacheImplement());
     $config->setMetadataCacheImpl(MyCache::getInstance("_doctrine_cache")->getCacheImplement());
     $config->setQueryCacheImpl(MyCache::getInstance("_doctrine_cache")->getCacheImplement());
     $config->setResultCacheImpl(MyCache::getInstance("_doctrine_cache")->getCacheImplement());
     $config->setHydrationCacheImpl(MyCache::getInstance("_doctrine_cache")->getCacheImplement());
     $config->setProxyDir(APPLICATION_PATH . '/Models/Proxies/__CG__/');
     // 		$config->setProxyDir(APPLICATION_PATH.'/Models/Proxies/__CG__/Models/Entities2');
     $config->setAutoGenerateProxyClasses(AbstractProxyFactory::AUTOGENERATE_FILE_NOT_EXISTS);
     $config->setProxyNamespace('Models\\Proxies\\');
     // 		\My\Doc
     $config->addCustomNumericFunction('RAND', 'My\\Doctrine\\DqlFunction\\Rand');
     // 		$config->setSQLLogger(new MySQLLogger());
     $connectionParams = MyDatabaseConfiguration::getConnectionParam();
     $conn = DriverManager::getConnection($connectionParams);
     return EntityManager::create($conn, $config);
 }
コード例 #2
0
ファイル: index.php プロジェクト: jay45/porn
require_once 'Zend/Loader/Autoloader.php';
$loader = \Zend_Loader_Autoloader::getInstance();
$loader->registerNamespace('My\\');
$loader->registerNamespace('Helper\\');
$loader->registerNamespace("Doctrine\\");
$loader->registerNamespace("Models\\");
//setupAutoload();
/** Zend_Session */
// Zend_Session::setOptions(array(
// 'cookie_lifetime' => 1200,
// 'gc_maxlifetime'  => 1200));
Zend_Session::start();
/* setup Cache System */
MyEntityManagerFactory::$isUpdateSchema = true;
MyCache::$namespacePrefix = "ns7";
MyCache::setType(MyCache::$TYPE_ARRAY);
/** configure front controller */
$front = Zend_Controller_Front::getInstance()->registerPlugin(MyPlugin::getInstance())->setRouter(MyRouterConfiguration::getRouter());
// MyDatabaseConfiguration::$databaseHost = '127.0.0.1';
// MyDatabaseConfiguration::$databaseName = 'swim';
// MyDatabaseConfiguration::$databaseUserName = '******';
// MyDatabaseConfiguration::$databasePassword = '******';
MyDatabaseConfiguration::$databaseHost = 'localhost';
MyDatabaseConfiguration::$databaseName = 'mapz_porn';
MyDatabaseConfiguration::$databaseUserName = '******';
MyDatabaseConfiguration::$databasePassword = '******';
TransactionManager::start();
//$application->bootstrap()->run();
$front->addControllerDirectory(APPLICATION_PATH . '/controllers');
$front->throwExceptions(true);
try {