$criteria->with=array('profile');
フィールドを追加すると、revent_datetime
常にNULLが返されますがwith
、revent_datetime
戻り権はありません。なぜwith
基準でそれが起こるのですか?
Controller.php
public function actionIndex()
{
$dayofweek = date('w');
$criteria = new CDbCriteria;
$criteria->select=array("
CASE
WHEN weekday >= $dayofweek
THEN CONCAT( DATE_ADD(CURDATE(), INTERVAL weekday - $dayofweek DAY), ' ', event_time )
ELSE CONCAT( DATE_ADD(CURDATE(), INTERVAL 7 - $dayofweek + weekday DAY), ' ', event_time )
END as revent_datetime,
CASE
WHEN weekday >= $dayofweek AND list_time IS NOT NULL
THEN CONCAT( DATE_ADD(CURDATE(), INTERVAL weekday - $dayofweek DAY), ' ', list_time )
ELSE CONCAT( DATE_ADD(CURDATE(), INTERVAL 7 - $dayofweek + weekday DAY), ' ', list_time )
END as rlist_datetime
");
$criteria->with=array('profile'); // Thats the line w/ problem.
$dataProvider=new CActiveDataProvider('Eventsreminder', array(
'criteria' => $criteria
));
$this->render('index',array(
'dataProvider'=>$dataProvider,
));
}
出力:
$dataProvider->profile->name = Profile Test
$dataProvider->revent_datetime = NULL // here is the problem
$dataProvider->rlist_datetime = 2013-01-11 20:00:00