1
有我計算(我試圖從昨天把所有「行動項目」,並將其儲存在「paste_due」以下,併爲今天的所有行動項目,並把它們存儲在一個更好的辦法「今天」) - 這是我的「代理」控制器(代理「的hasMany」 ActionItem和ActionItem「屬於關聯」劑)的內部:CakePHP的:日期範圍
public function planner() {
$yesterday = date("Y-m-d 23:59:59", strtotime("yesterday"));
$conditions = array('ActionItem.due <' => $yesterday, 'ActionItem.agent_id' => '1');
$this->set('past_due', $this->Agent->ActionItem->find('all', array('conditions' => $conditions)));
$today = date("Y-m-d 00:00:00", strtotime("today"));
$today_end = date("Y-m-d 23:59:59", strtotime("today"));
$conditions = array('ActionItem.due >' => $today, 'ActionItem.due <' => $today_end, 'ActionItem.agent_id' => '1');
$this->set('today', $this->Agent->ActionItem->find('all', array('conditions' => $conditions)));
}
上述工作,但我不知道這是否是最好的的方式去我..