From 04b367a4e344ec8b8f5b75cefba97428c16ce76a Mon Sep 17 00:00:00 2001 From: Radek Crlik Date: Tue, 19 Jul 2016 14:42:49 +0200 Subject: [PATCH] Fix for issue #11987 - Phalcon\Mvc\Model\Manager::_mergeFindParameters() merging conditions --- CHANGELOG.md | 1 + phalcon/mvc/model/manager.zep | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 607e1b575b0..da23322799c 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -105,6 +105,7 @@ - Fixed incorrect query when using NULL fields with `Phalcon\Validation\Validator\Uniqueness` - Fixed `Phalcon\Forms\Form::getValue`. Now Elements can have names that match with the internal Form getters [#10398](https://github.com/phalcon/cphalcon/issues/10398) - Add `setContentLength()` method to `Phalcon\Http\Response` +- Fixed `Phalcon\Mvc\Model\Manager::_mergeFindParameters` - Merging conditions [#11987](https://github.com/phalcon/cphalcon/issues/11987) # [2.0.13](https://github.com/phalcon/cphalcon/releases/tag/phalcon-v2.0.13) (2016-05-19) - Restored `Phalcon\Text::camelize` behavior [#11767](https://github.com/phalcon/cphalcon/issues/11767) diff --git a/phalcon/mvc/model/manager.zep b/phalcon/mvc/model/manager.zep index a169ad000f9..1502126102d 100644 --- a/phalcon/mvc/model/manager.zep +++ b/phalcon/mvc/model/manager.zep @@ -1129,7 +1129,7 @@ class Manager implements ManagerInterface, InjectionAwareInterface, EventsAwareI var key, value, findParams; if typeof findParamsOne == "string" && typeof findParamsTwo == "string" { - return ["(" . findParamsOne . ") AND " . findParamsTwo]; + return ["(" . findParamsOne . ") AND (" . findParamsTwo . ")"]; } let findParams = []; @@ -1141,7 +1141,7 @@ class Manager implements ManagerInterface, InjectionAwareInterface, EventsAwareI if !isset findParams[0] { let findParams[0] = value; } else { - let findParams[0] = "(" . findParams[0] . ") AND " . value; + let findParams[0] = "(" . findParams[0] . ") AND (" . value . ")"; } continue; } @@ -1162,7 +1162,7 @@ class Manager implements ManagerInterface, InjectionAwareInterface, EventsAwareI if !isset findParams[0] { let findParams[0] = value; } else { - let findParams[0] = "(" . findParams[0] . ") AND " . value; + let findParams[0] = "(" . findParams[0] . ") AND (" . value . ")"; } continue; } @@ -1187,7 +1187,7 @@ class Manager implements ManagerInterface, InjectionAwareInterface, EventsAwareI if !isset findParams[0] { let findParams[0] = findParamsTwo; } else { - let findParams[0] = "(" . findParams[0] . ") AND " . findParamsTwo; + let findParams[0] = "(" . findParams[0] . ") AND (" . findParamsTwo . ")"; } } }