private function getIncompleteOrderFromDB()
    {
        $order = Order::find()->where([
            'user_id' => \Yii::$app->user->id,
            'status' => OrderStatus::STATUS_INCOMPLETE])
            ->one();

        if (empty($order)) {
            $order = new Order();
            $order->uid = $this->generateUniqueId($this->uidPrefix, $this->minOrderUid, $this->maxOrderUid);
            $order->user_id = \Yii::$app->user->id;
            $order->status = OrderStatus::STATUS_INCOMPLETE;
            if ($order->validate()) {
                $order->save();
            }
        }
        return $order;
    }
private function getIncompleteOrderFromDB()
    {
        $order = Order::find()->where([
            'user_id' => \Yii::$app->user->id,
            'status' => OrderStatus::STATUS_INCOMPLETE])
            ->one();

        if (empty($order)) {
            $order = new Order();
            $order->uid = $this->generateUniqueId($this->uidPrefix, $this->minOrderUid, $this->maxOrderUid);
            $order->user_id = \Yii::$app->user->id;
            $order->status = OrderStatus::STATUS_INCOMPLETE;
            if ($order->validate()) {
                $order->save();
            }
        }
        return $order;
    }
private function getIncompleteOrderFromDB ( ) { $ order = Order :: find ( ) -> where ( [ 'user_id' => \ Yii :: $ app -> user -> id , 'status' => OrderStatus :: STATUS_INCOMPLETE ] ) -> one ( ) ; if ( empty ( $ order ) ) { $ order = new Order ( ) ; $ order -> uid = $ this -> generateUniqueId ( $ this -> uidPrefix , $ this -> minOrderUid , $ this -> maxOrderUid ) ; $ order -> user_id = \ Yii :: $ app -> user -> id ; $ order -> status = OrderStatus :: STATUS_INCOMPLETE ; if ( $ order -> validate ( ) ) { $ order -> save ( ) ; } } return $ order ; }
Gets or creates incomplete order record from database.
@return array|Order|null|ActiveRecord
Gets or creates incomplete order record from database .