Permalink
Browse files

Changed the order of the Select condition, to add the first instances…

… PredicateInterface
  • Loading branch information...
1 parent 469972c commit 9d5624c652c1335621610a9da7979d6391736923 @moura137 committed Jan 9, 2013
Showing with 4 additions and 3 deletions.
  1. +4 −3 library/Zend/Db/Sql/Select.php
@@ -286,6 +286,10 @@ public function where($predicate, $combination = Predicate\PredicateSet::OP_AND)
// as an Expression predicate
$predicate = new Predicate\Expression($pkey, $pvalue);
+ } elseif ($pvalue instanceof Predicate\PredicateInterface) {
+ // Predicate type is ok
+ $predicate = $pvalue;
+
} elseif (is_string($pkey)) {
// Otherwise, if still a string, do something intelligent with the PHP type provided
@@ -299,9 +303,6 @@ public function where($predicate, $combination = Predicate\PredicateSet::OP_AND)
// otherwise assume that array('foo' => 'bar') means "foo" = 'bar'
$predicate = new Predicate\Operator($pkey, Predicate\Operator::OP_EQ, $pvalue);
}
- } elseif ($pvalue instanceof Predicate\PredicateInterface) {
- // Predicate type is ok
- $predicate = $pvalue;
} else {
// must be an array of expressions (with int-indexed array)
$predicate = (strpos($pvalue, Expression::PLACEHOLDER) !== false)

0 comments on commit 9d5624c

Please sign in to comment.