mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fixing issue where habtm tables would not have the connection prefix removed when generating schema. Fixes #1180
This commit is contained in:
parent
cf50cbdd9d
commit
8d5e68d582
1 changed files with 8 additions and 3 deletions
|
@ -274,11 +274,16 @@ class CakeSchema extends Object {
|
|||
}
|
||||
if (is_object($Object->$class)) {
|
||||
$withTable = $db->fullTableName($Object->$class, false);
|
||||
if ($prefix && strpos($withTable, $prefix) !== 0) {
|
||||
continue;
|
||||
}
|
||||
if (in_array($withTable, $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);
|
||||
$noPrefixWith = str_replace($prefix, '', $withTable);
|
||||
|
||||
$tables[$noPrefixWith] = $this->__columns($Object->$class);
|
||||
$tables[$noPrefixWith]['indexes'] = $db->index($Object->$class);
|
||||
$tables[$noPrefixWith]['tableParameters'] = $db->readTableParameters($withTable);
|
||||
unset($currentTables[$key]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue