Posts Tagged ‘condition’

condition in find function cakephp

by on Wednesday, May 8th, 2013

How to get data on condition that start time only have current year data:


$event = $this->Event->find('first', array(
 'conditions' => array(
 'Event.id' => $targetEvent['Eventtarget']['event_id'],
 'Event.stage' => 'created',
 'year(Event.startTime)' => date('Y') ), //this is the condition we have to check
 'fields' => array('Event.startTime', 'Event.city', 'Event.zip', 'Event.employee_id')
 ));