diff --git a/cake/libs/model/cake_schema.php b/cake/libs/model/cake_schema.php index 28008cbd25d..989a529f0ee 100644 --- a/cake/libs/model/cake_schema.php +++ b/cake/libs/model/cake_schema.php @@ -245,7 +245,7 @@ function read($options = array()) { if (is_object($Object) && $Object->useTable !== false) { $Object->setDataSource($connection); - $table = $db->fullTableName($Object->useTable, false); + $table = $db->fullTableName($Object, false); if (in_array($table, $currentTables)) { $key = array_search($table, $currentTables); diff --git a/cake/tests/cases/libs/model/cake_schema.test.php b/cake/tests/cases/libs/model/cake_schema.test.php index 7b00d7b39c8..0a2dac13a6e 100644 --- a/cake/tests/cases/libs/model/cake_schema.test.php +++ b/cake/tests/cases/libs/model/cake_schema.test.php @@ -457,8 +457,17 @@ function testSchemaRead() { ConnectionManager::create('schema_prefix', $config); $read = $this->Schema->read(array('connection' => 'schema_prefix', 'models' => false)); $this->assertTrue(empty($read['tables'])); - } + $SchemaPost =& ClassRegistry::init('SchemaPost'); + $SchemaPost->table = 'sts'; + $SchemaPost->tablePrefix = 'po'; + $read = $this->Schema->read(array( + 'connection' => 'test_suite', + 'name' => 'TestApp', + 'models' => array('SchemaPost') + )); + $this->assertFalse(isset($read['tables']['missing']['posts']), 'Posts table was not read from tablePrefix %s'); + } /** * test reading schema from plugins. *