mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-03-18 23:49:55 +00:00
Fixing issue where join tables would be filed under 'missing' and found. Test added. Fixes #789
This commit is contained in:
parent
3c27c4c41e
commit
bd6e16be26
2 changed files with 8 additions and 2 deletions
|
@ -246,7 +246,6 @@ class CakeSchema extends Object {
|
||||||
if (is_object($Object) && $Object->useTable !== false) {
|
if (is_object($Object) && $Object->useTable !== false) {
|
||||||
$Object->setDataSource($connection);
|
$Object->setDataSource($connection);
|
||||||
$table = $db->fullTableName($Object, false);
|
$table = $db->fullTableName($Object, false);
|
||||||
|
|
||||||
if (in_array($table, $currentTables)) {
|
if (in_array($table, $currentTables)) {
|
||||||
$key = array_search($table, $currentTables);
|
$key = array_search($table, $currentTables);
|
||||||
if (empty($tables[$table])) {
|
if (empty($tables[$table])) {
|
||||||
|
@ -263,7 +262,7 @@ class CakeSchema extends Object {
|
||||||
if (is_object($Object->$class)) {
|
if (is_object($Object->$class)) {
|
||||||
$withTable = $db->fullTableName($Object->$class, false);
|
$withTable = $db->fullTableName($Object->$class, false);
|
||||||
if (in_array($withTable, $currentTables)) {
|
if (in_array($withTable, $currentTables)) {
|
||||||
$key = array_search($table, $currentTables);
|
$key = array_search($withTable, $currentTables);
|
||||||
$tables[$withTable] = $this->__columns($Object->$class);
|
$tables[$withTable] = $this->__columns($Object->$class);
|
||||||
$tables[$withTable]['indexes'] = $db->index($Object->$class);
|
$tables[$withTable]['indexes'] = $db->index($Object->$class);
|
||||||
$tables[$withTable]['tableParameters'] = $db->readTableParameters($withTable);
|
$tables[$withTable]['tableParameters'] = $db->readTableParameters($withTable);
|
||||||
|
|
|
@ -575,6 +575,13 @@ class CakeSchemaTest extends CakeTestCase {
|
||||||
'models' => array('SchemaPost')
|
'models' => array('SchemaPost')
|
||||||
));
|
));
|
||||||
$this->assertFalse(isset($read['tables']['missing']['posts']), 'Posts table was not read from tablePrefix %s');
|
$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');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue