hasManyで日付指定
hasManyで日付条件を指定する時のメモ。
hasManyで日付指定
$today = date('Y-m-d'); $nextWeek = date('Y-m-d', strtotime($today.'1 week')); $options = array( 'Recipe.date >=' => $today, 'Recipe.date <' => $nextWeek, ); $this->User->hasMany['Recipe']['conditions'] = $options;
その他の条件指定
$this->User->hasMany['Recipe']['limit'] = 1;
$this->User->hasMany['Recipe']['order'] = 'Recipe DESC';