Browse Source

Merge pull request #3015 from cakephp/dbosource-bc-fix

2.5 - Dbosource bc fix
Mark Story 12 years ago
parent
commit
100595b717
1 changed files with 5 additions and 1 deletions
  1. 5 1
      lib/Cake/Model/Datasource/DboSource.php

+ 5 - 1
lib/Cake/Model/Datasource/DboSource.php

@@ -1641,9 +1641,13 @@ class DboSource extends DataSource {
  *   String representing a query.
  *   True, when $external is false and association $type is 'hasOne' or 'belongsTo'.
  */
-	public function generateAssociationQuery(Model $Model, Model $LinkModel, $type, $association, $assocData, &$queryData, $external) {
+	public function generateAssociationQuery(Model $Model, $LinkModel, $type, $association, $assocData, &$queryData, $external) {
 		$assocData = $this->_scrubQueryData($assocData);
 
+		if ($LinkModel === null) {
+			return '';
+		}
+
 		if ($external && !empty($assocData['finderQuery'])) {
 			return $assocData['finderQuery'];
 		}