Yii 在关系查询中用三级“with”消除列的歧义


Yii disambiguate columns with three level "with" in relational query

在以下情况下:

'with'=>array('pros.comments', 'cons.comments')

消除"注释"歧义的解决方案是:

'with'=>array('pros.comments', 'cons.comments'=>array('alias'=>'con_comments'))

但是,如果我有三个级别呢:

'with'=>array('pros.comments.author', 'cons.comments.author')

???如何消除评论和作者的歧义?

提前致谢

试试这个

'with'=array('pros.comments'=>array('alias'=>'pros_comments','with'=>array('author'=>array('alias'=>'pros_comments_author'))),'cons.comments'=>array('alias'=>'cons_comments','with'=>array('author'=>array('alias'=>'cons_comments_author'))))