Short story: I want to create a CActiveDataProvider with a condition of a relation, of a relation equals "Wool".
After a search on the forum I’m still not able to solve this problem…
I’m posting the last reviews on the site, and works just fine:
$reviews = new CActiveDataProvider('Reviews', array(
'criteria' => array(
'order' => 'reviewDate DESC',
'limit' => 5
),
'pagination' => false
));
But now i want to create a condition from a relation, to a relation…
In a find function it looks like:
$reviews->merchant->merchantssubscriptions->subscription
and works just fine.
More explanation:
In my reviews model i’ve got a relation to merchant, looking like this:
'merchant' => array(self::BELONGS_TO, 'Merchants', 'merchantId'),
And merchants model like this:
'merchantssubscriptions' => array(self::HAS_ONE, 'Merchantssubscriptions', 'merchantId'),
I then want to get "merchantssubscriptions->subscription" as a condition…
I’m not sure how i can do this… Maybe with the “With” function in CActiveDataProvider, but after a lot of different tries i havent found a solution.
Hope somebody can help.
And please let me know if you need more information…
Thanks a lot.
Casper Skou