Browse files

Setting $primary = false inside DboSource::queryAssociation. Fixed #208

  • Loading branch information...
1 parent ea6e3dd commit 63ab96d751a7308fdb65c13d43a1a237bbc09eee @markstory markstory committed Nov 15, 2009
Showing with 4 additions and 4 deletions.
  1. +4 −4 cake/libs/model/datasources/dbo_source.php
View
8 cake/libs/model/datasources/dbo_source.php
@@ -798,12 +798,12 @@ function queryAssociation(&$model, &$linkModel, $type, $association, $assocData,
if (count($ins) > 1) {
$query = str_replace('{$__cakeID__$}', '(' .join(', ', $ins) .')', $query);
$query = str_replace('= (', 'IN (', $query);
- $query = str_replace('= (', 'IN (', $query);
+ $query = str_replace('= (', 'IN (', $query);
} else {
$query = str_replace('{$__cakeID__$}',$ins[0], $query);
}
- $query = str_replace(' WHERE 1 = 1', '', $query);
+ $query = str_replace(' WHERE 1 = 1', '', $query);
}
$foreignKey = $model->hasAndBelongsToMany[$association]['foreignKey'];
@@ -877,7 +877,7 @@ function queryAssociation(&$model, &$linkModel, $type, $association, $assocData,
$this->__mergeAssociation($resultSet[$i], $fetch, $association, $type, $selfJoin);
}
if (isset($resultSet[$i][$association])) {
- $resultSet[$i][$association] = $linkModel->afterFind($resultSet[$i][$association]);
+ $resultSet[$i][$association] = $linkModel->afterFind($resultSet[$i][$association], false);
}
} else {
$tempArray[0][$association] = false;
@@ -898,7 +898,7 @@ function fetchAssociated($model, $query, $ids) {
$query = str_replace('{$__cakeID__$}', join(', ', $ids), $query);
if (count($ids) > 1) {
$query = str_replace('= (', 'IN (', $query);
- $query = str_replace('= (', 'IN (', $query);
+ $query = str_replace('= (', 'IN (', $query);
}
return $this->fetchAll($query, $model->cacheQueries, $model->alias);
}

0 comments on commit 63ab96d

Please sign in to comment.