Hi everyone,
This might be a stupid question but it’s late and I’m pulling my hair out. Hopefully one of you can enlighten me.
Lets say I have a User and Post system. I would like to get all the users that have at least one published post. Do to so I have made a new CDbCriteria accordingly.
I have however hit a wall as I would like my CActiveDataProvider to also return information regarding -all- posts linked to said users. As it stands, I’m only (and logically) getting my user information and information regarding the published posts.
Bellow is an idea of what the code looks like:
$criteria = new CDbCriteria(array('with' => array('posts'=> array('condition'=>'published=:published',
'params'=>array(':published'=> '1')
)
),
'together' => true,
)
);
$preexisting_functional_criteria->mergeWith($criteria,true);
return CActiveDataProvider('User',array('criteria'=>$preexisting_functional_criteria));
Thanks in advance.