Permalink
Browse files

Fix translations of associative conditions (OR, AND...)

  • Loading branch information...
1 parent 069c48b commit 3d444f3f71383ee8ca53a3912fab9ae881b5537d @CauanCabral CauanCabral committed Mar 26, 2013
Showing with 7 additions and 8 deletions.
  1. +7 −8 Model/Behavior/SqlCompatibleBehavior.php
@@ -205,6 +205,12 @@ protected function _translateConditions(Model &$Model, &$conditions) {
$return = true;
continue;
}
+ if (is_numeric($key) && is_array($value)) {
+ if ($this->_translateConditions($Model, $value)) {
+ $return = true;
+ continue;
+ }
+ }
if (substr($uKey, -3) === 'NOT') {
// 'Special' case because it's awkward
$childKey = key($value);
@@ -247,17 +253,10 @@ protected function _translateConditions(Model &$Model, &$conditions) {
$return = true;
continue;
}
-
if (!in_array(substr($key, -1), array('>', '<', '='))) {
$return = true;
continue;
}
- if (is_numeric($key && is_array($value))) {
- if ($this->_translateConditions($Model, $value)) {
- $return = true;
- continue;
- }
- }
$parts = explode(' ', $key);
$operator = array_pop($parts);
if ($operator = $this->_translateOperator($Model, $operator)) {
@@ -292,4 +291,4 @@ protected function _translateOperator(Model $Model, $operator) {
}
return '';
}
-}
+}

0 comments on commit 3d444f3

Please sign in to comment.