Permalink
Browse files

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 eff4004

Refs #3532
Fixes #3605
  • Loading branch information...
markstory committed Feb 7, 2013
1 parent 758d717 commit 7d72a6f249f174bc9b07a69456be457db6cca2eb
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/Cake/Console/Command/Task/ModelTask.php
@@ -623,9 +623,9 @@ public function findHasAndBelongsToMany(Model $model, $associations) {
$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)) {

0 comments on commit 7d72a6f

Please sign in to comment.