Reputation: 11
i need to convert following mysql condition to Cakephp find condition.
select * from bookings where (check_out_date - check_in_date) <=600 ;
Please help me.
Upvotes: 1
Views: 148
Reputation: 14544
$this->Booking->find('all', array(
'conditions' => array(
'(Booking.check_out_date - Booking.check_in_date) <=' => 600
)
));
Upvotes: 2
Reputation: 27364
try following code and debug it.
$bookings = $this->Booking->find('all',array
(
'conditions' => array
(
'(Booking.check_out_date - Booking.check_in_date) <=' => 600
),
'fields' => array
(
'Booking.*'
),
'recursive' => -1
));
above code is tested and work like a charm.
Upvotes: -1