Skip to content

Commit

Permalink
Changed the order of the Select condition, to add the first instances…
Browse files Browse the repository at this point in the history
… PredicateInterface
  • Loading branch information
moura137 committed Feb 8, 2013
1 parent 469972c commit 9d5624c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions library/Zend/Db/Sql/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
Expand Down

0 comments on commit 9d5624c

Please sign in to comment.