components/actions/Action.php
protected function _fetchOne($id)
    {

        /** @var ActiveRecord $model */
        $model = $this->query->andWhere([$this->tableName. '.id' => $id])->one();

        if (!$model)
            throw new NotFoundHttpException(Yii::t('wavecms/main', 'Element not found'));

        if ($this->controller->scenario) {
            $model->scenario = $this->controller->scenario;
        }

        return $model;
    }
protected function _fetchOne($id)
    {

        /** @var ActiveRecord $model */
        $model = $this->query->andWhere([$this->tableName. '.id' => $id])->one();

        if (!$model)
            throw new NotFoundHttpException(Yii::t('wavecms/main', 'Element not found'));

        if ($this->controller->scenario) {
            $model->scenario = $this->controller->scenario;
        }

        return $model;
    }
protected function _fetchOne ( $ id ) { /** @var ActiveRecord $model */ $ model = $ this -> query -> andWhere ( [ $ this -> tableName . '.id' => $ id ] ) -> one ( ) ; if ( ! $ model ) throw new NotFoundHttpException ( Yii :: t ( 'wavecms/main' , 'Element not found' ) ) ; if ( $ this -> controller -> scenario ) { $ model -> scenario = $ this -> controller -> scenario ; } return $ model ; }
Function to get one model by id. Using in crete/update/page action
@param $id
@return ActiveRecord
@throws \yii\web\NotFoundHttpException
@throws InvalidConfigException
Function to get one model by id . Using in crete / update / page action