建议tp出一个类似yii2版本的查询with()的功能

浏览:1577 发布日期:2015/12/07 分类:站务建议
强烈建议tp出一个类似yii2版本的查询with()的功能,此功能可以节省很多开发时间,下面是yii2的with使用案例:

// 查询客户与他们的订单和国家
CustomerModel::find()->with('orders', 'country')->all();

// 查询客户与他们的订单和订单的发货地址
CustomerModel::find()->with('orders.address')->all();

// 查询客户与他们的国家和状态为1的订单
CustomerModel::find()->with([
'orders' => function ($query) {
$query->andWhere('status = 1');
},
'country',
])->all();
最佳答案
评论( 相关
后面还有条评论,点击查看>>