2009-05-04 16:26:54 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Bootstrap Doctrine.php, register autoloader specify
|
|
|
|
* configuration attributes and load models.
|
|
|
|
*/
|
|
|
|
require_once 'Doctrine.php';
|
|
|
|
spl_autoload_register(array('Doctrine', 'autoload'));
|
|
|
|
$manager = Doctrine_Manager::getInstance();
|
2009-05-12 15:40:22 +02:00
|
|
|
$manager->setAttribute( Doctrine::ATTR_MODEL_LOADING, Doctrine::MODEL_LOADING_CONSERVATIVE );
|
2009-05-04 16:26:54 +02:00
|
|
|
$manager->setAttribute( Doctrine::ATTR_AUTO_ACCESSOR_OVERRIDE, TRUE );
|
2009-05-12 15:40:22 +02:00
|
|
|
$manager->setAttribute( Doctrine::ATTR_USE_NATIVE_ENUM, TRUE );
|
2009-05-07 16:31:17 +02:00
|
|
|
/*
|
|
|
|
$manager->setCollate('utf8_unicode_ci');
|
|
|
|
$manager->setCharset('utf8');
|
|
|
|
*/
|
2009-05-13 18:06:14 +02:00
|
|
|
$graydonConn = Doctrine_Manager::connection('mysql://'.MYSQL_USER.':'.MYSQL_PASS.'@'.MYSQL_HOST.'/graydon', 'graydon');
|
|
|
|
Doctrine::loadModels(realpath(dirname(__FILE__)).'/models/graydon');
|
|
|
|
$intersudConn = Doctrine_Manager::connection('mysql://'.MYSQL_USER.':'.MYSQL_PASS.'@'.MYSQL_HOST.'/intersud', 'intersud');
|
|
|
|
Doctrine::loadModels(realpath(dirname(__FILE__)).'/models/intersud');
|
|
|
|
$sdv1Conn = Doctrine_Manager::connection('mysql://'.MYSQL_USER.':'.MYSQL_PASS.'@'.MYSQL_HOST.'/sdv1', 'sdv1');
|
|
|
|
Doctrine::loadModels(realpath(dirname(__FILE__)).'/models/sdv1');
|
2009-05-12 15:40:22 +02:00
|
|
|
/*
|
|
|
|
$connection->setCollate('utf8_unicode_ci');
|
|
|
|
$connection->setCharset('utf8');
|
|
|
|
*/
|
2009-05-13 18:06:14 +02:00
|
|
|
function setDbConn($name){
|
|
|
|
global $manager;
|
|
|
|
$currentName = $manager->getCurrentConnection()->getName();
|
|
|
|
$currentConn = $manager->getCurrentConnection();
|
|
|
|
if($currentName != $name){
|
2009-05-14 18:44:36 +02:00
|
|
|
//$manager->closeConnection($currentConn);
|
2009-05-14 12:08:43 +02:00
|
|
|
$manager->setCurrentConnection($name);
|
|
|
|
Doctrine::loadModels(realpath(dirname(__FILE__)).'/models/'.$name);
|
2009-05-13 18:06:14 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-05-04 16:26:54 +02:00
|
|
|
?>
|