Changeset 4682 for branches/1.0/lib/Doctrine/Import.php
- Timestamp:
- 07/13/08 01:14:08 (6 months ago)
- Files:
-
- 1 modified
-
branches/1.0/lib/Doctrine/Import.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/1.0/lib/Doctrine/Import.php
r4617 r4682 364 364 public function importSchema($directory, array $databases = array(), array $options = array()) 365 365 { 366 $options['singularize'] = ! isset($options['singularize']) ?367 $this->conn->getAttribute('singularize_import'):$options['singularize'];368 369 366 $connections = Doctrine_Manager::getInstance()->getConnections(); 370 367 … … 386 383 $definition['tableName'] = $table; 387 384 388 if( ! isset($options['singularize']) || $options['singularize'] !== false) { 389 $classTable = $this->_singularizeTableName($table); 390 } else { 391 $classTable = Doctrine_Inflector::tableize($table); 392 } 385 $classTable = Doctrine_Inflector::tableize($table); 393 386 394 387 $definition['className'] = Doctrine_Inflector::classify($classTable); … … 401 394 foreach ($relations as $relation) { 402 395 $table = $relation['table']; 403 if( ! isset($options['singularize']) || $options['singularize'] !== false) { 404 $relClassTable = $this->_singularizeTableName($table); 405 } else { 406 $relClassTable = Doctrine_Inflector::tableize($table); 407 } 396 $relClassTable = Doctrine_Inflector::tableize($table); 408 397 $class = Doctrine_Inflector::classify($relClassTable); 409 398 if (in_array($class, $classes)) { … … 433 422 return $classes; 434 423 } 435 436 /**437 * Singularize a table name438 *439 * @param string $tableName440 * @return $singularTableName441 */442 protected function _singularizeTableName($tableName)443 {444 $e = explode('_', Doctrine_Inflector::tableize($tableName));445 foreach ($e as $k => $v) {446 $e[$k] = Doctrine_Inflector::singularize($v);447 }448 return implode('_', $e);449 }450 424 }