Fixing issue where join tables would be filed under 'missing' and found. Test added. Fixes #789

This commit is contained in:
mark_story 2010-06-03 23:20:37 -04:00
parent 3c27c4c41e
commit bd6e16be26
2 changed files with 8 additions and 2 deletions

View file

@ -246,7 +246,6 @@ class CakeSchema extends Object {
if (is_object($Object) && $Object->useTable !== false) {
$Object->setDataSource($connection);
$table = $db->fullTableName($Object, false);
if (in_array($table, $currentTables)) {
$key = array_search($table, $currentTables);
if (empty($tables[$table])) {
@ -263,7 +262,7 @@ class CakeSchema extends Object {
if (is_object($Object->$class)) {
$withTable = $db->fullTableName($Object->$class, false);
if (in_array($withTable, $currentTables)) {
$key = array_search($table, $currentTables);
$key = array_search($withTable, $currentTables);
$tables[$withTable] = $this->__columns($Object->$class);
$tables[$withTable]['indexes'] = $db->index($Object->$class);
$tables[$withTable]['tableParameters'] = $db->readTableParameters($withTable);

View file

@ -575,6 +575,13 @@ class CakeSchemaTest extends CakeTestCase {
'models' => array('SchemaPost')
));
$this->assertFalse(isset($read['tables']['missing']['posts']), 'Posts table was not read from tablePrefix %s');
$read = $this->Schema->read(array(
'connection' => 'test_suite',
'name' => 'TestApp',
'models' => array('SchemaComment', 'SchemaTag', 'SchemaPost')
));
$this->assertFalse(isset($read['tables']['missing']['posts_tags']), 'Join table marked as missing %s');
}
/**