Skip to content
This repository
Browse code

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

  • Loading branch information...
commit 63ab96d751a7308fdb65c13d43a1a237bbc09eee 1 parent ea6e3dd
Mark Story authored
8  cake/libs/model/datasources/dbo_source.php
@@ -798,12 +798,12 @@ function queryAssociation(&$model, &$linkModel, $type, $association, $assocData,
798 798
 					if (count($ins) > 1) {
799 799
 						$query = str_replace('{$__cakeID__$}', '(' .join(', ', $ins) .')', $query);
800 800
 						$query = str_replace('= (', 'IN (', $query);
801  
-						$query = str_replace('=	 (', 'IN (', $query);
  801
+						$query = str_replace('= (', 'IN (', $query);
802 802
 					} else {
803 803
 						$query = str_replace('{$__cakeID__$}',$ins[0], $query);
804 804
 					}
805 805
 
806  
-					$query = str_replace('	WHERE 1 = 1', '', $query);
  806
+					$query = str_replace(' WHERE 1 = 1', '', $query);
807 807
 				}
808 808
 
809 809
 				$foreignKey = $model->hasAndBelongsToMany[$association]['foreignKey'];
@@ -877,7 +877,7 @@ function queryAssociation(&$model, &$linkModel, $type, $association, $assocData,
877 877
 						$this->__mergeAssociation($resultSet[$i], $fetch, $association, $type, $selfJoin);
878 878
 					}
879 879
 					if (isset($resultSet[$i][$association])) {
880  
-						$resultSet[$i][$association] = $linkModel->afterFind($resultSet[$i][$association]);
  880
+						$resultSet[$i][$association] = $linkModel->afterFind($resultSet[$i][$association], false);
881 881
 					}
882 882
 				} else {
883 883
 					$tempArray[0][$association] = false;
@@ -898,7 +898,7 @@ function fetchAssociated($model, $query, $ids) {
898 898
 		$query = str_replace('{$__cakeID__$}', join(', ', $ids), $query);
899 899
 		if (count($ids) > 1) {
900 900
 			$query = str_replace('= (', 'IN (', $query);
901  
-			$query = str_replace('=	 (', 'IN (', $query);
  901
+			$query = str_replace('= (', 'IN (', $query);
902 902
 		}
903 903
 		return $this->fetchAll($query, $model->cacheQueries, $model->alias);
904 904
 	}

0 notes on commit 63ab96d

Please sign in to comment.
Something went wrong with that request. Please try again.