Adding fix from Ticket #2336

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4747 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2007-04-03 21:12:09 +00:00
parent ed342c307d
commit 065b93c29a

View file

@ -399,9 +399,9 @@ class Bake {
} else { } else {
$currentModelName = $enteredModel; $currentModelName = $enteredModel;
} }
$db =& ConnectionManager::getDataSource($useDbConfig); $db =& ConnectionManager::getDataSource($useDbConfig);
$useTable = Inflector::tableize($currentModelName); $useTable = Inflector::tableize($currentModelName);
$fullTableName = $db->fullTableName($useTable, false); $fullTableName = $db->fullTableName($useTable, false);
if(array_search($useTable, $this->__tables) === false) { if(array_search($useTable, $this->__tables) === false) {
@ -424,7 +424,7 @@ class Bake {
} }
} }
$wannaDoValidation = $this->getInput('Would you like to supply validation criteria for the fields in your model?', array('y','n'), 'y'); $wannaDoValidation = $this->getInput('Would you like to supply validation criteria for the fields in your model?', array('y','n'), 'y');
if(in_array($useTable, $this->__tables)) { if(in_array($useTable, $this->__tables)) {
loadModel(); loadModel();
$tempModel = new Model(false, $useTable); $tempModel = new Model(false, $useTable);
@ -449,7 +449,7 @@ class Bake {
$prompt .= "4- VALID_YEAR\n"; $prompt .= "4- VALID_YEAR\n";
$prompt .= "5- Do not do any validation on this field.\n\n"; $prompt .= "5- Do not do any validation on this field.\n\n";
$prompt .= "... or enter in a valid regex validation string.\n\n"; $prompt .= "... or enter in a valid regex validation string.\n\n";
if($field['null'] == 1 || $field['name'] == $primaryKey || $field['name'] == 'created' || $field['name'] == 'modified') { if($field['null'] == 1 || $field['name'] == $primaryKey || $field['name'] == 'created' || $field['name'] == 'modified') {
$validation = $this->getInput($prompt, null, '5'); $validation = $this->getInput($prompt, null, '5');
} else { } else {
@ -2343,7 +2343,7 @@ class Bake {
$count = count($tables); $count = count($tables);
for ($i = 0; $i < $count; $i++) { for ($i = 0; $i < $count; $i++) {
if(low($type) == 'controllers') { if(low($type) == 'controllers') {
$this->__controllerNames[] = $this->__controllerName($tables[$i]); $this->__controllerNames[] = $this->__controllerName($this->__modelName($tables[$i]));
$this->stdout($i + 1 . ". " . $this->__controllerNames[$i]); $this->stdout($i + 1 . ". " . $this->__controllerNames[$i]);
} else { } else {
$this->__modelNames[] = $this->__modelName($tables[$i]); $this->__modelNames[] = $this->__modelName($tables[$i]);