Hi,
I am trying to search persons model who has relation with parent
I want to filter the parent relation attributes by using criteria->with
$criteria->condition = $criteria->condition.' and parent.is_active=:active';
$total = persons::model()->with('parent')->count($criteria);
$pages = new CPagination($total);
$pages->setPageSize(20);
$pages->applyLimit($criteria);
$list = persons ::model()->with('parent')->findAll($criteria);
error
Unknown column ‘parent.is_active’ in ‘where clause’
I understand this is due to the lazy loading not joining with the parent model.
But how to achieve the filter on relation and pagination together in any case lazy or eager loading ?
pls. note iam not using cgridview just html table in the view. but
$this->widget('CLinkPager', array(
'currentPage'=>$pages->getCurrentPage(),
'itemCount'=>$total,
'pageSize'=>$page_size,
'maxButtonCount'=>5,
'header'=>'',
'htmlOptions'=>array('class'=>'pages'),
));?>
Thanks alot