毎月の日付範囲で各顧客のすべてのサービスを見つけようとしています。この回答済みの質問CakePHP: Date Rangeに従って、サマリー コントローラーでこのコードを作成しました。
public function view($id=null) {
//other code
$this->loadModel('Event');
$summary = $this->Summary->find('first', array('conditions' => array('Summary.id' => $id)));
$first = date('m-01-Y', strtotime($summary['Summary']['date']));
//added this for debugging and the value is the date i want
$this->set('first', $first);
$last = date('m-t-Y', strtotime($summary['Summary']['date']));
//debugging, this works too
$this->set('last', $last);
$conditions = array("'Event.start' >=" => $first, "'Event.start' <=" => $last,
'Event.customer_id' => 'Summary.customer_id'
);
$this->set('events', $this->Event->find('all', array('conditions' => $conditions)));
しかし、私のビューの $events 変数は空です。また、日付範囲をテストするために customer_id 条件を削除しようとしましたが、問題は「Event.start」を正しく比較できなかったようです。date() 関数は引用符内では使用できません。ヒントはありますか?