commit a5023eb9de8f076c9670da4cfeeef11cd341e186 Author: Kousuke Ebihara Date: Mon Sep 10 17:47:04 2012 +0900 複数接続時に翻訳テーブルの初期化に失敗していたのを修正 diff --git a/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Record/Generator.php b/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Record/Generator.php index 728207e..4ef793c 100644 --- a/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Record/Generator.php +++ b/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Record/Generator.php @@ -32,6 +32,8 @@ */ abstract class Doctrine_Record_Generator extends Doctrine_Record_Abstract { + protected static $initializedTables = array(); + /** * _options * @@ -160,12 +162,13 @@ abstract class Doctrine_Record_Generator extends Doctrine_Record_Abstract $this->_options['tableName'] = str_replace('%TABLE%', $ownerTableName, $tableName); } - // check that class doesn't exist (otherwise we cannot create it) - if ($this->_options['generateFiles'] === false && class_exists($this->_options['className'])) { - $this->_table = Doctrine_Core::getTable($this->_options['className']); - return false; + $currentTableHash = spl_object_hash($table); + if (!empty(self::$initializedTables[$currentTableHash])) { + return null; } + self::$initializedTables[$currentTableHash] = true; + $this->buildTable(); $fk = $this->buildForeignKeys($this->_options['table']); @@ -177,7 +180,9 @@ abstract class Doctrine_Record_Generator extends Doctrine_Record_Abstract $this->setTableDefinition(); $this->setUp(); - $this->generateClassFromTable($this->_table); + if ($this->_options['generateFiles'] === true || !class_exists($this->_options['className'])) { + $this->generateClassFromTable($this->_table); + } $this->buildChildDefinitions(); @@ -467,4 +472,4 @@ abstract class Doctrine_Record_Generator extends Doctrine_Record_Abstract eval($def); } } -} \ No newline at end of file +}