protected function getParameterModel($paramName, $modelClassName, $requestParams)
    {
        $paramModel = new $modelClassName;

        if (!$paramModel instanceof \yii\base\Model) {
            throw new \yii\base\InvalidParamException("Parameter '{$paramName}' must be instance of \yii\base\Model");
        }

        if (in_array($this->scenario, $paramModel->scenarios())) {
            $paramModel->scenario = $this->scenario;
            $paramModel->setAttributes($requestParams[$paramName], true);
        } else {
            $paramModel->setAttributes($requestParams[$paramName], false);
        }

        if (!$paramModel->validate()) {
            throw new ValidationException('Invalid JSON-RPC request parameters.', 0, $paramModel->getErrors());
        }

        return $paramModel;
    }
protected function getParameterModel($paramName, $modelClassName, $requestParams)
    {
        $paramModel = new $modelClassName;

        if (!$paramModel instanceof \yii\base\Model) {
            throw new \yii\base\InvalidParamException("Parameter '{$paramName}' must be instance of \yii\base\Model");
        }

        if (in_array($this->scenario, $paramModel->scenarios())) {
            $paramModel->scenario = $this->scenario;
            $paramModel->setAttributes($requestParams[$paramName], true);
        } else {
            $paramModel->setAttributes($requestParams[$paramName], false);
        }

        if (!$paramModel->validate()) {
            throw new ValidationException('Invalid JSON-RPC request parameters.', 0, $paramModel->getErrors());
        }

        return $paramModel;
    }
protected function getParameterModel ( $ paramName , $ modelClassName , $ requestParams ) { $ paramModel = new $ modelClassName ; if ( ! $ paramModel instanceof \ yii \ base \ Model ) { throw new \ yii \ base \ InvalidParamException ( "Parameter '{$paramName}' must be instance of \yii\base\Model" ) ; } if ( in_array ( $ this -> scenario , $ paramModel -> scenarios ( ) ) ) { $ paramModel -> scenario = $ this -> scenario ; $ paramModel -> setAttributes ( $ requestParams [ $ paramName ] , true ) ; } else { $ paramModel -> setAttributes ( $ requestParams [ $ paramName ] , false ) ; } if ( ! $ paramModel -> validate ( ) ) { throw new ValidationException ( 'Invalid JSON-RPC request parameters.' , 0 , $ paramModel -> getErrors ( ) ) ; } return $ paramModel ; }
Creates and validates model for controller action argument
@param string $paramName
@param string $modelClassName
@param array $requestParams
@return \yii\base\Model
@throws \yii\base\InvalidParamException
@throws \yii\web\BadRequestHttpException
Creates and validates model for controller action argument