一对一模型关联中,嵌套预载入,如何实现嵌套查询?

浏览:1525 发布日期:2017/04/10 分类:ThinkPHP5专区
Order模型关联User模型,User模型关联Profile模型,

在TP5.0.5中,$query= new model\Order();
$query->with(
[
'user'=>function($query){$query->field('user_name');},
'user.profile'=>function($query){$query->field('real_name');},
]
);
这样报错:method not exist:think\db\Query->user.profile
最佳答案
评论( 相关
后面还有条评论,点击查看>>