fixing issue with bake reading tables

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4468 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
gwoo 2007-02-07 21:29:47 +00:00
parent 90b0f1f1cc
commit 7754dbd284

View file

@ -422,18 +422,18 @@ class Bake {
while($tableIsGood == false && low($useTable) != 'null') { while($tableIsGood == false && low($useTable) != 'null') {
$db =& ConnectionManager::getDataSource($useDbConfig); $db =& ConnectionManager::getDataSource($useDbConfig);
$fullTableName = $db->fullTableName($useTable, false); $fullTableName = $db->fullTableName($useTable, false);
$sources = $db->listSources(); if (is_array($this->__tables) && !in_array($fullTableName, $this->__tables)) {
if (is_array($sources) && !in_array(low($fullTableName), array_map('low', $sources))) {
$this->stdout($fullTableName . ' does not exist.'); $this->stdout($fullTableName . ' does not exist.');
$useTable = $this->getInput('What is the name of the table (enter "null" to use NO table)?'); $useTable = $this->getInput('What is the name of the table (enter "null" to use NO table)?');
$tableIsGood = false; $tableIsGood = false;
} else { } else {
$useTable = $fullTableName;
$tableIsGood = true; $tableIsGood = true;
} }
} }
$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(array_search($useTable, $this->__tables)) { if(in_array($useTable, $this->__tables)) {
loadModel(); loadModel();
$tempModel = new Model(false, $useTable); $tempModel = new Model(false, $useTable);
$db =& ConnectionManager::getDataSource($useDbConfig); $db =& ConnectionManager::getDataSource($useDbConfig);