Hello everyone,

I'm trying to perform a find operation on my 'event' model in order to
retrieve "events" that fall within a specific date range. I've read
the manual on the process to do complex find conditions but thus far
I've been unable to get it to generate working SQL code that will
accomplish my goal.

The following is my find statement (here's to hoping the formatting
sticks somewhat) :

$events = $this->Event->find('all', array('recursive' => 1,
                        'conditions' => array(
                          'User.id' => $currUser['id'],
                        'or' => array(
                          'Event.startTime BETWEEN ? AND ?' =>
array($bottomSearchBound,$topSearchBound),
                          'Event.endTime BETWEEN ? AND ?' =>
array($bottomSearchBound,$topSearchBound)
                      )
                    )
            ));

The sql it generates (snipped version) is as follows:

WHERE `User`.`id` = 7 AND ((`Event`.`startTime BETWEEN ? AND ?` IN
('2008-08-01', '2008-10-01') ) OR (`Event`.`endTime BETWEEN ? AND ?`
IN ('2008-08-01', '2008-10-01') ))

And the error it generates is:

Warning (512): SQL Error: 1054: Unknown column 'Event.startTime
BETWEEN ? AND ?' in 'where clause'

Obviously the "?" token replacement isn't being completed
successfully.

Any help would be _greatly_ appreciated!

- Daniel

--~--~---------~--~----~------------~-------~--~----~
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