mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-09-06 03:22:39 +00:00
Fix issue where bake was missing habtm associations
If the current model is not the first table, habtm associations would be
missed. This was caused by eff4004261
Refs #3532
Fixes #3605
This commit is contained in:
parent
758d717096
commit
7d72a6f249
1 changed files with 2 additions and 2 deletions
|
@ -623,9 +623,9 @@ class ModelTask extends BakeTask {
|
|||
$offset = strpos($otherTable, $model->table . '_');
|
||||
$otherOffset = strpos($otherTable, '_' . $model->table);
|
||||
|
||||
if ($offset === 0) {
|
||||
if ($offset !== false) {
|
||||
$tableName = substr($otherTable, strlen($model->table . '_'));
|
||||
} elseif ($otherOffset === 0) {
|
||||
} elseif ($otherOffset !== false) {
|
||||
$tableName = substr($otherTable, 0, $otherOffset);
|
||||
}
|
||||
if ($tableName && in_array($tableName, $this->_tables)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue