Changeset 4301
- Timestamp:
- 04/30/08 05:03:15 (14 months ago)
- Location:
- branches/0.11
- Files:
-
- 17 modified
-
lib/Doctrine.php (modified) (2 diffs)
-
lib/Doctrine/Cli.php (modified) (3 diffs)
-
lib/Doctrine/Data/Import.php (modified) (1 diff)
-
lib/Doctrine/Import/Builder.php (modified) (1 diff)
-
lib/Doctrine/Import/Schema.php (modified) (2 diffs)
-
lib/Doctrine/Migration.php (modified) (1 diff)
-
lib/Doctrine/Migration/Builder.php (modified) (2 diffs)
-
lib/Doctrine/Table.php (modified) (3 diffs)
-
lib/Doctrine/Task.php (modified) (1 diff)
-
tests/coverage/Doctrine_Data_Import.html (modified) (1 diff)
-
tests/coverage/Doctrine_Import_Builder.html (modified) (1 diff)
-
tests/coverage/Doctrine_Import_Schema.html (modified) (3 diffs)
-
tests/coverage/Doctrine_Migration.html (modified) (1 diff)
-
tests/coverage/Doctrine_Migration_Builder.html (modified) (2 diffs)
-
tests/coverage/Doctrine_Table.html (modified) (3 diffs)
-
tests/ImportTestCase.php (modified) (1 diff)
-
tests/ManagerTestCase.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/0.11/lib/Doctrine.php
r4297 r4301 1001 1001 1002 1002 /** 1003 * fileFinder1004 *1005 * @param string $type1006 * @return void1007 */1008 public static function fileFinder($type)1009 {1010 return Doctrine_FileFinder::type($type);1011 }1012 1013 /**1014 1003 * compile 1015 1004 * … … 1099 1088 return implode("\n", $ret); 1100 1089 } 1101 1102 /**1103 * tableize1104 *1105 * returns table name from class name1106 *1107 * @param string $classname1108 * @return string1109 */1110 public static function tableize($className)1111 {1112 return Doctrine_Inflector::tableize($className);1113 }1114 1115 /**1116 * classify1117 *1118 * returns class name from table name1119 *1120 * @param string $tablename1121 * @return string1122 */1123 public static function classify($tableName)1124 {1125 return Doctrine_Inflector::classify($tableName);1126 }1127 1128 /**1129 * isValidClassName1130 *1131 * checks for valid class name (uses camel case and underscores)1132 *1133 * @param string $classname1134 * @return boolean1135 */1136 public static function isValidClassname($className)1137 {1138 return Doctrine_Lib::isValidClassName($className);1139 }1140 1141 /**1142 * makeDirectories1143 *1144 * Makes the directories for a path recursively1145 *1146 * @param string $path1147 * @return void1148 */1149 public static function makeDirectories($path, $mode = 0777)1150 {1151 return Doctrine_Lib::makeDirectories($path, $mode);1152 }1153 1154 /**1155 * removeDirectories1156 *1157 * @param string $folderPath1158 * @return void1159 */1160 public static function removeDirectories($folderPath)1161 {1162 return Doctrine_Lib::removeDirectories($folderPath);1163 }1164 1090 } -
branches/0.11/lib/Doctrine/Cli.php
r4287 r4301 103 103 { 104 104 $taskName = str_replace('-', '_', $args[1]); 105 $taskClass = 'Doctrine_Task_' . Doctrine ::classify($taskName);105 $taskClass = 'Doctrine_Task_' . Doctrine_Inflector::classify($taskName); 106 106 107 107 return $taskClass; … … 213 213 public function printTasks($task = null, $full = false) 214 214 { 215 $task = Doctrine ::classify(str_replace('-', '_', $task));215 $task = Doctrine_Inflector::classify(str_replace('-', '_', $task)); 216 216 217 217 $tasks = $this->getLoadedTasks(); … … 227 227 $className = 'Doctrine_Task_' . $taskName; 228 228 $taskInstance = new $className(); 229 $taskInstance->taskName = str_replace('_', '-', Doctrine ::tableize($taskName));229 $taskInstance->taskName = str_replace('_', '-', Doctrine_Inflector::tableize($taskName)); 230 230 231 231 $syntax = $this->_scriptName . ' ' . $taskInstance->getTaskName(); -
branches/0.11/lib/Doctrine/Data/Import.php
r4285 r4301 194 194 if ($obj->getTable()->hasField($key)) { 195 195 $obj->set($key, $value); 196 } else if (method_exists($obj, 'set' . Doctrine ::classify($key))) {197 $func = 'set' . Doctrine ::classify($key);196 } else if (method_exists($obj, 'set' . Doctrine_Inflector::classify($key))) { 197 $func = 'set' . Doctrine_Inflector::classify($key); 198 198 $obj->$func($value); 199 199 } else if ($obj->getTable()->hasRelation($key)) { -
branches/0.11/lib/Doctrine/Import/Builder.php
r4278 r4301 301 301 public function setOption($key, $value) 302 302 { 303 $name = 'set' . Doctrine ::classify($key);303 $name = 'set' . Doctrine_Inflector::classify($key); 304 304 305 305 if (method_exists($this, $name)) { -
branches/0.11/lib/Doctrine/Import/Schema.php
r4289 r4301 340 340 $tableName = null; 341 341 } else { 342 $tableName = Doctrine ::tableize($className);342 $tableName = Doctrine_Inflector::tableize($className); 343 343 } 344 344 } … … 528 528 // Attempt to guess the local and foreign 529 529 if (isset($relation['refClass'])) { 530 $relation['local'] = isset($relation['local']) ? $relation['local']:Doctrine ::tableize($name) . '_id';531 $relation['foreign'] = isset($relation['foreign']) ? $relation['foreign']:Doctrine ::tableize($class) . '_id';530 $relation['local'] = isset($relation['local']) ? $relation['local']:Doctrine_Inflector::tableize($name) . '_id'; 531 $relation['foreign'] = isset($relation['foreign']) ? $relation['foreign']:Doctrine_Inflector::tableize($class) . '_id'; 532 532 } else { 533 $relation['local'] = isset($relation['local']) ? $relation['local']:Doctrine ::tableize($relation['class']) . '_id';533 $relation['local'] = isset($relation['local']) ? $relation['local']:Doctrine_Inflector::tableize($relation['class']) . '_id'; 534 534 $relation['foreign'] = isset($relation['foreign']) ? $relation['foreign']:'id'; 535 535 } -
branches/0.11/lib/Doctrine/Migration.php
r3884 r4301 335 335 foreach ($this->_changes as $type => $changes) { 336 336 $process = new Doctrine_Migration_Process(); 337 $funcName = 'process' . Doctrine ::classify($type);337 $funcName = 'process' . Doctrine_Inflector::classify($type); 338 338 339 339 if ( ! empty($changes)) { -
branches/0.11/lib/Doctrine/Migration/Builder.php
r4115 r4301 180 180 $down = $this->buildDropTable($export); 181 181 182 $className = 'Add' . Doctrine ::classify($export['tableName']);182 $className = 'Add' . Doctrine_Inflector::classify($export['tableName']); 183 183 184 184 $this->generateMigrationClass($className, array(), $up, $down); … … 281 281 $next = (string) $this->migration->getNextVersion(); 282 282 283 $fileName = str_repeat('0', (3 - strlen($next))) . $next . '_' . Doctrine ::tableize($className) . $this->suffix;283 $fileName = str_repeat('0', (3 - strlen($next))) . $next . '_' . Doctrine_Inflector::tableize($className) . $this->suffix; 284 284 285 285 $class = $this->buildMigrationClass($className, $fileName, $options, $up, $down); -
branches/0.11/lib/Doctrine/Table.php
r4300 r4301 233 233 } else { 234 234 if ( ! isset($this->_options['tableName'])) { 235 $this->_options['tableName'] = Doctrine ::tableize($this->_options['name']);235 $this->_options['tableName'] = Doctrine_Inflector::tableize($this->_options['name']); 236 236 } 237 237 } … … 347 347 348 348 if ( ! isset($this->_options['tableName'])) { 349 $this->_options['tableName'] = Doctrine ::tableize($class->getName());349 $this->_options['tableName'] = Doctrine_Inflector::tableize($class->getName()); 350 350 } 351 351 … … 2126 2126 } 2127 2127 2128 $fieldName = Doctrine ::tableize($by);2128 $fieldName = Doctrine_Inflector::tableize($by); 2129 2129 $hydrationMode = isset($arguments[1]) ? $arguments[1]:null; 2130 2130 -
branches/0.11/lib/Doctrine/Task.php
r3950 r4301 54 54 $this->dispatcher = $dispatcher; 55 55 56 $this->taskName = str_replace('_', '-', Doctrine ::tableize(str_replace('Doctrine_Task_', '', get_class($this))));56 $this->taskName = str_replace('_', '-', Doctrine_Inflector::tableize(str_replace('Doctrine_Task_', '', get_class($this)))); 57 57 } 58 58 -
branches/0.11/tests/coverage/Doctrine_Data_Import.html
r4113 r4301 512 512 </td></tr> 513 513 <tr><td>168</td> 514 <td class="covered"> } else if (method_exists($obj, 'set' . Doctrine ::classify($key))) {514 <td class="covered"> } else if (method_exists($obj, 'set' . Doctrine_Inflector::classify($key))) { 515 515 </td></tr> 516 516 <tr><td>169</td> 517 <td class="red"> $func = 'set' . Doctrine ::classify($key);517 <td class="red"> $func = 'set' . Doctrine_Inflector::classify($key); 518 518 </td></tr> 519 519 <tr><td>170</td> -
branches/0.11/tests/coverage/Doctrine_Import_Builder.html
r4112 r4301 839 839 </td></tr> 840 840 <tr><td>277</td> 841 <td class="covered"> $name = 'set' . Doctrine ::classify($key);841 <td class="covered"> $name = 'set' . Doctrine_Inflector::classify($key); 842 842 </td></tr> 843 843 <tr><td>278</td> -
branches/0.11/tests/coverage/Doctrine_Import_Schema.html
r4112 r4301 1016 1016 </td></tr> 1017 1017 <tr><td>336</td> 1018 <td class="covered"> $tableName = Doctrine ::tableize($className);1018 <td class="covered"> $tableName = Doctrine_Inflector::tableize($className); 1019 1019 </td></tr> 1020 1020 <tr><td>337</td> … … 1580 1580 </td></tr> 1581 1581 <tr><td>524</td> 1582 <td class="red"> $relation['local'] = isset($relation['local']) ? $relation['local']:Doctrine ::tableize($name) . '_id';1582 <td class="red"> $relation['local'] = isset($relation['local']) ? $relation['local']:Doctrine_Inflector::tableize($name) . '_id'; 1583 1583 </td></tr> 1584 1584 <tr><td>525</td> 1585 <td class="red"> $relation['foreign'] = isset($relation['foreign']) ? $relation['foreign']:Doctrine ::tableize($class) . '_id';1585 <td class="red"> $relation['foreign'] = isset($relation['foreign']) ? $relation['foreign']:Doctrine_Inflector::tableize($class) . '_id'; 1586 1586 </td></tr> 1587 1587 <tr><td>526</td> … … 1589 1589 </td></tr> 1590 1590 <tr><td>527</td> 1591 <td class="covered"> $relation['local'] = isset($relation['local']) ? $relation['local']:Doctrine ::tableize($relation['class']) . '_id';1591 <td class="covered"> $relation['local'] = isset($relation['local']) ? $relation['local']:Doctrine_Inflector::tableize($relation['class']) . '_id'; 1592 1592 </td></tr> 1593 1593 <tr><td>528</td> -
branches/0.11/tests/coverage/Doctrine_Migration.html
r4112 r4301 1019 1019 </td></tr> 1020 1020 <tr><td>337</td> 1021 <td class="covered"> $funcName = 'process' . Doctrine ::classify($type);1021 <td class="covered"> $funcName = 'process' . Doctrine_Inflector::classify($type); 1022 1022 </td></tr> 1023 1023 <tr><td>338</td> -
branches/0.11/tests/coverage/Doctrine_Migration_Builder.html
r4113 r4301 554 554 </td></tr> 555 555 <tr><td>182</td> 556 <td class="red"> $className = 'Add' . Doctrine ::classify($export['tableName']);556 <td class="red"> $className = 'Add' . Doctrine_Inflector::classify($export['tableName']); 557 557 </td></tr> 558 558 <tr><td>183</td> … … 857 857 </td></tr> 858 858 <tr><td>283</td> 859 <td class="red"> $fileName = str_repeat('0', (3 - strlen($next))) . $next . '_' . Doctrine ::tableize($className) . $this->suffix;859 <td class="red"> $fileName = str_repeat('0', (3 - strlen($next))) . $next . '_' . Doctrine_Inflector::tableize($className) . $this->suffix; 860 860 </td></tr> 861 861 <tr><td>284</td> -
branches/0.11/tests/coverage/Doctrine_Table.html
r4112 r4301 713 713 </td></tr> 714 714 <tr><td>235</td> 715 <td class="covered"> $this->_options['tableName'] = Doctrine ::tableize($this->_options['name']);715 <td class="covered"> $this->_options['tableName'] = Doctrine_Inflector::tableize($this->_options['name']); 716 716 </td></tr> 717 717 <tr><td>236</td> … … 1055 1055 </td></tr> 1056 1056 <tr><td>349</td> 1057 <td class="covered"> $this->_options['tableName'] = Doctrine ::tableize($class->getName());1057 <td class="covered"> $this->_options['tableName'] = Doctrine_Inflector::tableize($class->getName()); 1058 1058 </td></tr> 1059 1059 <tr><td>350</td> … … 6038 6038 </td></tr> 6039 6039 <tr><td>2010</td> 6040 <td class="covered"> $fieldName = Doctrine ::tableize($by);6040 <td class="covered"> $fieldName = Doctrine_Inflector::tableize($by); 6041 6041 </td></tr> 6042 6042 <tr><td>2011</td> -
branches/0.11/tests/ImportTestCase.php
r4106 r4301 50 50 $this->assertTrue(file_exists('Import/_files/ImportTestUser.php')); 51 51 $this->assertTrue(file_exists('Import/_files/generated/BaseImportTestUser.php')); 52 Doctrine ::removeDirectories('Import/_files');52 Doctrine_Lib::removeDirectories('Import/_files'); 53 53 } 54 54 } -
branches/0.11/tests/ManagerTestCase.php
r4093 r4301 52 52 public function testClassifyTableize() { 53 53 $name = "Forum_Category"; 54 $this->assertEqual(Doctrine ::tableize($name), "forum__category");55 $this->assertEqual(Doctrine ::classify(Doctrine::tableize($name)), $name);54 $this->assertEqual(Doctrine_Inflector::tableize($name), "forum__category"); 55 $this->assertEqual(Doctrine_Inflector::classify(Doctrine_Inflector::tableize($name)), $name); 56 56 57 57