Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixing issue where join tables would be filed under 'missing' and fou…

…nd. Test added. Fixes #789
  • Loading branch information...
commit bd6e16be261d532da30d417e48c7f57c9be21550 1 parent 3c27c4c
@markstory markstory authored
View
3  cake/libs/model/cake_schema.php
@@ -246,7 +246,6 @@ function read($options = array()) {
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 @@ function read($options = array()) {
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
7 cake/tests/cases/libs/model/cake_schema.test.php
@@ -575,6 +575,13 @@ function testSchemaRead() {
'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');
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.