Hello everyone!
Please, have a look at this piece of code and tell me if there is a better or an easier way to implement it:
$model=Item::model()->with(array(
'pro_feedbacks.comments'=>array(
'with'=>array(
'author'=>array(
'select'=>'user_id, fullname',
)
)
),
'pro_feedbacks.commentCount',
'con_feedbacks.comments'=>array(
'alias'=>'con_comments',
'with'=>array(
'author'=>array(
'alias'=>'com_author',
'select'=>'user_id, fullname'
)
)
),
'con_feedbacks.commentCount'=>array('alias'=>'con_commCount')
))->findByPk($id);
I guess there are too many arrays and number of arrays can be minimized.
Thanks in advance!