tp6使用withJoin遇到的小坑

使用withJoin来联模型的时候

假如是一个单词的表:user

在使用的时候

withJoin(['user'])->select();

没有问题 查出来使用user.xxx参数就可以使用了

但是假如是一个驼峰参数命名的模型比如 UserQuestion

使用完后

withJoin('UserQuestion')->select();

查询出来的属性不是userQuestion.xxx 而是 userQuestion__xxx才能使用注意是两个下划线。。。。

可能是我使用方式不对吧  挺坑的

原文地址:https://www.cnblogs.com/stan-an/p/13554558.html