protected function saveOrdersItem($items, $orderId)
 {
     foreach ($items as $id => $item) {
         $ordersItem = new OrdersItem();
         $ordersItem->order_id = $orderId;
         $ordersItem->reservationinfo_id = $id;
         $ordersItem->price = $item['price'];
         $ordersItem->qty_item = $item['qty'];
         $ordersItem->sum_item = $item['qty'] * $item['price'];
         $ordersItem->save();
     }
 }
 function actionView()
 {
     $ordersId = Yii::$app->request->get('ordersId');
     $ordersItem = OrdersItem::find()->select('orders_item.*')->leftJoin('reservationinfo', 'reservationinfo.id = orders_item.reservationinfo_id')->rightJoin('objreservation', 'objreservation.id = reservationinfo.objreservation_id')->where(['=', 'orders_item.order_id', $ordersId])->all();
     $this->layout = false;
     return $this->render('view', compact('ordersItem', 'ordersId'));
 }
Beispiel #3
0
 public function getOrdersItem()
 {
     return $this->hasMany(OrdersItem::className(), ['order_id' => 'id']);
 }