I agree - it gets pretty convoluted when you add a bit of complexity
into the conditions.
However, I haven't yet come up with a better syntax (aside from
writing plain sql of course).
Have you got any suggestions?
Adam
On Nov 21, 3:23 am, zonium [EMAIL PROTECTED] wrote:
I figured it out:
On Nov 21, 3:23 pm, Adam Royle [EMAIL PROTECTED] wrote:
I agree - it gets pretty convoluted when you add a bit of complexity
into the conditions.
Where is the complexity in the stated example?
Any nested array that is written on a single line is going to be
'difficult' to read as such it's
In fact, my select statement was
$count =$this-PromoCode-findCount(array(PromoCode.start_date =
$datetime, 'PromoCode.promo_code'=$promo_code,
OR=array('PromoCode.active'='1')));
and
Cake created:
SELECT COUNT(*) AS `count` FROM `promo_codes` AS `PromoCode` WHERE
`PromoCode`.`start_date`
I figured it out:
The statement should be:
$count =$this-PromoCode-
findCount(array('or'=array(array(PromoCode.start_date =
$datetime, 'PromoCode.promo_code'=$promo_code),
array('PromoCode.active'='1';
and the result is as expected:
SELECT COUNT(*) AS `count` FROM `promo_codes` AS
I have these statements:
$datetime = date(Y-m-d H:i:s);
$count =$this-PromoCode-findCount(array(PromoCode.start_date =
$datetime, OR=array('PromoCode.active'='1')));
With debug enabled I saw cake tried to create this query:
SELECT COUNT(*) AS `count` FROM `promo_codes` AS `PromoCode` WHERE
Put both conditions in the 'or' key:
$datetime = date(Y-m-d H:i:s);
$count =$this-PromoCode-
findCount(array(OR=array(PromoCode.start_date = $datetime,
'PromoCode.active'='1')));
On Nov 20, 11:49 am, zonium [EMAIL PROTECTED] wrote:
I have these statements:
$datetime = date(Y-m-d H:i:s);