关于with查询

怎么知道当前的AR是否with了其它AR一起查询。

如:




$user = User::model()->with('profile')->find(..);

if ($user->hasWith('profile')) {


}



有没有类似hasWith的相关方法,谢谢

试一下hasRelated方法,这个方法返回boolean类型的


$user = User::model()->with('profile')->find(..); 

if ($user->hasRelated('profile')) { 

 

}

hasRelated 嗯。非常管用,谢谢

不明白怎么个非常管用法?

楼上试试就知道了,我亲自试了,也是非常管用。

。。。看看!