I have a model called ActionCategories that ‘HAS_MANY’ Actions. The relation is defined as ‘actionsRel’. I have the following in my controller:
$criteria = new CDbCriteria();
$criteria->together = TRUE;
$criteria->with = 'actionsRel';
$criteria->condition = 'actionsRel.task_status = \'NOT DONE\'';
$dataProvider = new CActiveDataProvider(ActionCategory::model(), array('criteria'=>$criteria));
$this->render('index', array('actionCategories' => $dataProvider));
When I use this the CListView widget I’m using in my view only returns 4 records. Also, if I tail the MySQL logs I notice that lazy loading is being performed.
Is there any way to implement the above with eager loading?