From 5a944734b8261079bb83d1b8b6dce1b6276e3c57 Mon Sep 17 00:00:00 2001 From: mark_story <mark@mark-story.com> Date: Wed, 12 Mar 2014 23:30:46 -0400 Subject: [PATCH 1/2] Remove typehint on $LinkModel argument. Adding a typehint here causes errors in a few userland plugins. We should honor the previous interface as best we can. --- lib/Cake/Model/Datasource/DboSource.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cake/Model/Datasource/DboSource.php b/lib/Cake/Model/Datasource/DboSource.php index d6c019f50..4be0d74d2 100644 --- a/lib/Cake/Model/Datasource/DboSource.php +++ b/lib/Cake/Model/Datasource/DboSource.php @@ -1641,7 +1641,7 @@ 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 ($external && !empty($assocData['finderQuery'])) { From 3a226b03c3ca5ea255d2e1ec22bb9bd51fc13ea8 Mon Sep 17 00:00:00 2001 From: mark_story <mark@mark-story.com> Date: Wed, 12 Mar 2014 23:42:21 -0400 Subject: [PATCH 2/2] Remove typehint from generateAssociationQuery() While I think typehints are generally a good idea, this one broke a few plugins, notably CakeDC/search. I don't think it is wise for 2.X release to break BC in that way. I think reverting this change is probably the safest path right now. --- lib/Cake/Model/Datasource/DboSource.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/Cake/Model/Datasource/DboSource.php b/lib/Cake/Model/Datasource/DboSource.php index 4be0d74d2..a7ce76d35 100644 --- a/lib/Cake/Model/Datasource/DboSource.php +++ b/lib/Cake/Model/Datasource/DboSource.php @@ -1644,6 +1644,10 @@ class DboSource extends DataSource { 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']; }