Closed lox closed 11 years ago
This is a response to bug #27.
As originally designed, the and() and or() methods on a Criteria object didn't chain:
<?php $c = new Criteria(); $c->and('llamas = true')->and('quantity > 1'); // results in (quantity > 1)
Obviously this wasn't expected, or the desired behavior, but it came about to support complex chaining like:
<?php $c = new Criteria(); $c->or( $c->and('llamas = true', 'quantity > 1'), 'alpaca = true' ); // results in (llamas = true AND quantity > 1) OR alpaca = true
The more I've thought about that syntax, the crazier it is. The above is now accomplished like this:
<?php $c = new Criteria(); $c->or( Criteria::concatAnd('llamas = true', 'quantity > 1'), 'alpaca = true' ); // results in (llamas = true AND quantity > 1) OR alpaca = true
Chaining now works as you'd expect it to:
<?php $c = new Criteria(); $c->and('llamas = true')->and('quantity > 1'); // results in ((llamas = true) AND quantity > 1)
This is a response to bug #27.
As originally designed, the and() and or() methods on a Criteria object didn't chain:
Obviously this wasn't expected, or the desired behavior, but it came about to support complex chaining like:
The more I've thought about that syntax, the crazier it is. The above is now accomplished like this:
Chaining now works as you'd expect it to: