Browse files

Merge pull request #70 from radig/cake2.2

Fix translations of associative conditions (OR, AND...)
  • Loading branch information...
2 parents 069c48b + 3d444f3 commit e3d05a59638fb5dd00c0dc4d88d5494294bdbd10 @k1LoW k1LoW committed Mar 27, 2013
Showing with 7 additions and 8 deletions.
  1. +7 −8 Model/Behavior/SqlCompatibleBehavior.php
View
15 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 e3d05a5

Please sign in to comment.