Loading

yii2.0 联表查询数据库报错:undefined index order_id

1.在查询时加了->select();如下,要加上order_id,即关联的字段(比如:order_id)比如要在select中,否则会报错:undefined index order_id

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

 

posted @ 2018-08-28 13:33  5572  阅读(279)  评论(1编辑  收藏  举报