Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
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...
commit 7d72a6f249f174bc9b07a69456be457db6cca2eb 1 parent 758d717
@markstory markstory authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/Cake/Console/Command/Task/ModelTask.php
View
4 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)) {
Please sign in to comment.
Something went wrong with that request. Please try again.