Sure I'm missing out something or not thinking about a better way to accomplish what I need, but here is what I want to do.
I have three models: A, B and C. A has a relation MANY-MANY with B called relation1, and Bhas a relation MANY-MANY with C, called relation2. I want to get all B records with their C relations (eager loading), but just from an A instance (lazy loading, because I don't want to waste memory loading all relation1 instances).
So, what I want to do should be something like the following:
A::model()->findByPk($somePrimaryKey)->relation1->with('relation2');
Of course that's not working because using relation1 lazy loading I'm getting an array of instances and then I'm tryng to apply the with() method to a non-object.
Sure I can do a little bit of work around iterating through the array, but I want to know if there is a quick and elegent way :)
Thank you!