Re: Complex Find Conditions (using arrays) , a bug in 1.2?

2007-11-21 Thread Adam Royle
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:

Re: Complex Find Conditions (using arrays) , a bug in 1.2?

2007-11-21 Thread AD7six
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

Re: Complex Find Conditions (using arrays) , a bug in 1.2?

2007-11-20 Thread zonium
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`

Re: Complex Find Conditions (using arrays) , a bug in 1.2?

2007-11-20 Thread zonium
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

Complex Find Conditions (using arrays) , a bug in 1.2?

2007-11-19 Thread zonium
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

Re: Complex Find Conditions (using arrays) , a bug in 1.2?

2007-11-19 Thread Grant Cox
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);