Recursive Eager Loading Related Model

Hi,

I have a problem with multi-content of tree-childs of the same model

the schema is

Root Post

-> Child Post

-> Child(level 2) Post


   ...->

-> Child Post

-> Child(level 2) Post


   ...->

each most can be multiple languages, so if I want to fetch a Post with all child-posts of specific language I have to do this:


$res = self::model()->with(array(

                    'Content' => array(, //content multilanguage

                        'on' => 'Content.lang=:lang', 'params' => array(':lang' => $lang),

                    ),

                    'Childs' => array( //is a relation on the same model (recursive)

                        'with' => array('Content' => array('on' => 'lang=:lang', 'params' => array(':lang' => $lang))),

                        'together' => true,

                    ),

                ))->together()->findAll();



but due to Lazy loading system the 2-level Child ($res->Childs[0]->Childs[0]->Content) will ignore the above rule ‘with’ ‘Childs’ => array( … ) so all languages will be loaded on the 2-lever child

How to avoid this ? I want for any level-child loaded only the specific language

Thanks!

Anyone Yii speciallist ? :unsure:

I doubt it can be done using ‘together’ => true.

Thanks samdark for the reply

Do you have any suggestion ?