プロジェクト

全般

プロフィール

changeset_ra5023eb9de8f076c9670da4cfeeef11cd341e186.diff

Kousuke Ebihara, 2012-09-11 22:10

ダウンロード (2.23 KB)

差分を表示:

lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Record/Generator.php
32 32
 */
33 33
abstract class Doctrine_Record_Generator extends Doctrine_Record_Abstract
34 34
{
35
    protected static $initializedTables = array();
36

  
35 37
    /**
36 38
     * _options
37 39
     *
......
160 162
            $this->_options['tableName'] = str_replace('%TABLE%', $ownerTableName, $tableName);
161 163
        }
162 164

  
163
        // check that class doesn't exist (otherwise we cannot create it)
164
        if ($this->_options['generateFiles'] === false && class_exists($this->_options['className'])) {
165
            $this->_table = Doctrine_Core::getTable($this->_options['className']);
166
            return false;
165
        $currentTableHash = spl_object_hash($table);
166
        if (!empty(self::$initializedTables[$currentTableHash])) {
167
            return null;
167 168
        }
168 169

  
170
        self::$initializedTables[$currentTableHash] = true;
171

  
169 172
        $this->buildTable();
170 173

  
171 174
        $fk = $this->buildForeignKeys($this->_options['table']);
......
177 180
        $this->setTableDefinition();
178 181
        $this->setUp();
179 182

  
180
        $this->generateClassFromTable($this->_table);
183
        if ($this->_options['generateFiles'] === true || !class_exists($this->_options['className'])) {
184
            $this->generateClassFromTable($this->_table);
185
        }
181 186

  
182 187
        $this->buildChildDefinitions();
183 188

  
......
467 472
            eval($def);
468 473
        }
469 474
    }
470
}
475
}