我有3个表格(order
,order_delivery
,order_types
)。每张桌子都有模特。对于订单我创建GridView。表格order
包含列order_number
,表order_delivery
包含order_number
和order_delivery_code
,表格order_type
包含delivery_types_code
和delivery_types_name
}。按顺序我写函数
public function getType() {
return $this->hasOne(OrderDelivery::className(), ['order_id' => 'order_id'])
->viaTable('delivery-types', ['delivery-types_code' => 'order_delivery_code']);
}
在index
我写type.delivery-types_name
- 有
获取未知属性:backend \ models \ Order :: order_delivery_code
我做错了什么?
UPD。我的错)
public function getType(){
return $this->hasOne(DeliveryTypes::className(), ['delivery-types_code' => 'order_delivery_code'])
->viaTable('order_delivery', ['order_id' => 'order_id']);
}