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:
mark_story 2013-02-06 20:31:15 -05:00
parent 758d717096
commit 7d72a6f249

View file

@ -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)) {