Changeset 4394
- Timestamp:
- 06/25/07 19:59:38 (1 year ago)
- Files:
-
- plugins/sfDoctrinePlugin/lib (modified) (1 prop)
- plugins/sfDoctrinePlugin/lib/sfDoctrineAdminGenerator.class.php (modified) (1 diff)
- plugins/sfDoctrinePlugin/lib/sfDoctrineConnectionListener.class.php (modified) (2 diffs)
- plugins/sfDoctrinePlugin/lib/sfDoctrineDatabase.class.php (modified) (2 diffs)
- plugins/sfDoctrinePlugin/lib/sfDoctrineQueryLogger.class.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/sfDoctrinePlugin/lib
- Property svn:externals changed from
doctrine -r1785 http://doctrine.pengus.net/svn/trunk/lib
to
doctrine -r1821 http://doctrine.pengus.net/svn/trunk/lib
- Property svn:externals changed from
plugins/sfDoctrinePlugin/lib/sfDoctrineAdminGenerator.class.php
r4101 r4394 31 31 protected function loadMapBuilderClasses() 32 32 { 33 $db = new Doctrine_Db_Mock('mock://no-one@localhost/empty','',''); 34 $conn = Doctrine_Manager::getInstance()->openConnection($db, null, false); 33 $conn = Doctrine_Manager::getInstance()->openConnection('mock://no-one@localhost/empty', null, false); 35 34 $this->table = $conn->getTable($this->getClassName()); 36 35 } plugins/sfDoctrinePlugin/lib/sfDoctrineConnectionListener.class.php
r3327 r4394 15 15 */ 16 16 17 class sfDoctrineConnectionListener extends Doctrine_ Db_EventListener17 class sfDoctrineConnectionListener extends Doctrine_EventListener 18 18 { 19 19 … … 24 24 } 25 25 26 public function onConnect(Doctrine_ Db_Event $event)26 public function onConnect(Doctrine_Event $event) 27 27 { 28 28 $this->connection->setCharset($this->encoding); plugins/sfDoctrinePlugin/lib/sfDoctrineDatabase.class.php
r3993 r4394 79 79 try 80 80 { 81 $pdo_username = $this->getParameter('username'); 82 $pdo_password = $this->getParameter('password'); 81 // Make sure we pass non-PEAR style DSNs as an array 82 if ( ! strpos($dsn, '://')) 83 { 84 $dsn = array($dsn, $this->getParameter('username'), $this->getParameter('password')); 85 } 83 86 84 $dbh = new Doctrine_Db($dsn, $pdo_username, $pdo_password); 85 86 $this->doctrineConnection = Doctrine_Manager::connection($dbh, $name); 87 $this->doctrineConnection = Doctrine_Manager::connection($dsn, $name); 87 88 88 89 // figure out the encoding … … 97 98 // we add the listener that sets up encoding and date formats 98 99 $eventListener = new sfDoctrineConnectionListener($this->doctrineConnection, $encoding); 99 $this->doctrineConnection-> getDbh()->addListener($eventListener);100 $this->doctrineConnection->addListener($eventListener); 100 101 101 102 // add the query logger 102 103 if (sfConfig::get('sf_debug') && sfConfig::get('sf_logging_enabled')) 103 104 { 104 $this->doctrineConnection-> getDbh()->addListener(new sfDoctrineQueryLogger());105 $this->doctrineConnection->addListener(new sfDoctrineQueryLogger()); 105 106 } 106 107 } plugins/sfDoctrinePlugin/lib/sfDoctrineQueryLogger.class.php
r3362 r4394 15 15 */ 16 16 17 class sfDoctrineQueryLogger extends Doctrine_ Db_EventListener17 class sfDoctrineQueryLogger extends Doctrine_EventListener 18 18 { 19 19 protected $connection = null; 20 20 protected $encoding = 'UTF8'; 21 21 22 public function onPreExecute(Doctrine_ Db_Event $event)22 public function onPreExecute(Doctrine_Event $event) 23 23 { 24 24 $log = '{sfDoctrine Pre-execute} executeQuery : '.$event->getQuery(); … … 31 31 } 32 32 33 public function onExecute(Doctrine_ Db_Event $event)33 public function onExecute(Doctrine_Event $event) 34 34 { 35 35 sfTimerManager::getTimer('Database (Doctrine)')->addTime(); 36 36 } 37 37 38 public function onPreQuery(Doctrine_ Db_Event $event)38 public function onPreQuery(Doctrine_Event $event) 39 39 { 40 40 sfContext::getInstance()->getLogger()->log('{sfDoctrine Query} executeQuery : '.$event->getQuery()); … … 42 42 } 43 43 44 public function onQuery(Doctrine_ Db_Event $event)44 public function onQuery(Doctrine_Event $event) 45 45 { 46 46 sfTimerManager::getTimer('Database (Doctrine)')->addTime();