I have the following tables:
One campaign has many builds and a build has many buildparams.
How can I get all the buildparams based on a campaign id?
Make sure to set up your relations in your objects, and then you can call
$criteria = new CDbCriteria();
$criteria->condition = ‘campaign_id = :campaign_id’
$criteria->params = array(’:campaign_id’ => $campaign_id);
then you can do either
And you should get everything from all three tables. You can find more info on setting up relationships here:
Please let me know if you still have trouble after reading these docs and I can try to help you with your relationships as well.
thanks for your answer.
Can you explain how to set up the relations in the objects.
It is not really clear to me how to do this.
did you check this chapter from the guide ?
Note that if you use yiic (or even better : gii) to generate automatically your model classes, relations are automatically created. Then take a look at the relation method to understand better.
Hope this helps
Thanks for the answers. I have figured it out