One of the samples in the book is wrong Page 107:
function findByYear($year=null) {
$date = $year.'-01-01 00:00:00';
$end_date = $year.'-12-31 23:59:59';
return $this->find('all',array('conditions'=>array('DATE(Post.date)'=>'>'.$date,'DATE(Post.date)'=>'<'.$end_date)));
}
The correct function is:
function findByYear($year=null) {
$date = $year.'-01-01 00:00:00';
$end_date = $year.'-12-31 23:59:59';
return $this->find('all',array('conditions'=>array('DATE(Post.date) >' => $date,'DATE(Post.date) <' => $end_date)));
}
I hope this helps.
Thanks!