On Wed, Jan 7, 2009 at 4:50 PM, gearvOsh <[email protected]> wrote:
>
> Here you go:
>
> return $this->find (
>    'list',
>    array (
>        'fields' => array ( 'Alert.message' ),
>        'conditions' => array (
>                'Alert.alert_subject_id' => strtoupper ( $subject ),
>            'OR' => array(
>                array(
>                        'Alert.start_date'     => null,
>                                'Alert.start_date <= ' => date ( 'Y-m-d H:i:s' 
> )
>                ),
>                array (
>                        'Alert.end_date'       => null,
>                        'Alert.end_date >= '   => date ( 'Y-m-d H:i:s' )
>                )
>                        )
>        )
>    )
> );

I really appreciate the help, but that's not quite right. That syntax
ANDs the two start_date values and ANDs the two end_date values, but
ORs the two condition pairs. I need to do exactly the opposite:
(start_date condition1 OR start_date condition2) AND (end_date
condition1 OR end_date condition2).

Your solution lead me to try this (which I think I'd already tried,
but after a while I lost track):

                return $this->find (
                        'list',
                        array (
                                'fields' => array ( 'Alert.message' ),
                                'conditions' => array (
                                        'Alert.alert_subject_id' => strtoupper 
( $subject ),
                                        'AND' => array (
                                                'OR' => array (
                                                                
'Alert.start_date'     => null,
                                                                
'Alert.start_date <= ' => date ( 'Y-m-d H:i:s' )
                                                ),
                                                'OR' => array (
                                                                
'Alert.end_date'       => null,
                                                                'Alert.end_date 
>= '   => date ( 'Y-m-d H:i:s' )
                                                )
                                        )
                                )
                        )
                );

Unfortunately, I got the same result as above. I also tried another
variation on that with no luck. I'm going to try a simple, stupid test
next to see if I can get it working in a simpler form and work my way
up to what I need. I jumped right in because I didn't expect to have
so much trouble with it. :-)

Thanks again.

-- 
Rob Wilkerson
http://robwilkerson.org

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to