rest\Controller afterAction()

afterAction() public method This method is invoked right after an action is executed. The method will trigger the EVENT_AFTER_ACTION event. The return value of the method will be used as the action return value. If you override this method, your code should look like the following: public function afterAction($action, $result) { $result = parent::afterAction($action, $result); // your custom code here return $result; } public mixed afterAction ( $action, $result )$action yii\

rest\Controller $serializer

$serializer public property The configuration for creating the serializer that formats the response data. public string|array $serializer = 'yii\rest\Serializer'

rest\Controller $enableCsrfValidation

$enableCsrfValidation public property Whether to enable CSRF validation for the actions in this controller. CSRF validation is enabled only when both this property and yii\web\Request::$enableCsrfValidation are true. Whether to enable CSRF validation for the actions in this controller. CSRF validation is enabled only when both this property and yii\web\Request::$enableCsrfValidation are true. public boolean $enableCsrfValidation = false

rest\ActiveController verbs()

verbs() protected method Declares the allowed HTTP verbs. Please refer to \yii\rest\VerbFilter::actions on how to declare the allowed verbs. protected array verbs ( )return array The allowed HTTP verbs.

rest\ActiveController init()

init() public method Initializes the object. This method is invoked at the end of the constructor after the object is initialized with the given configuration. public void init ( )

rest\ActiveController checkAccess()

checkAccess() public method Checks the privilege of the current user. This method should be overridden to check whether the current user has the privilege to run the specified action against the specified data model. If the user does not have access, a yii\web\ForbiddenHttpException should be thrown. public void checkAccess ( $action, $model = null, $params = [] )$action string The ID of the action to be executed $model object The model to be accessed. If null, it means no specific mod

rest\ActiveController actions()

actions() public method Declares external actions for the controller. This method is meant to be overwritten to declare external actions for the controller. It should return an array, with array keys being action IDs, and array values the corresponding action class names or action configuration arrays. For example, return [ 'action1' => 'app\components\Action1', 'action2' => [ 'class' => 'app\components\Action2', 'property1' => 'value1', 'property

rest\ActiveController $updateScenario

$updateScenario public property The scenario used for updating a model. See also yii\base\Model::scenarios(). public string $updateScenario = \yii\base\Model::SCENARIO_DEFAULT

rest\ActiveController $modelClass

$modelClass public property The model class name. This property must be set. public string $modelClass = null

rest\ActiveController $createScenario

$createScenario public property The scenario used for creating a model. See also yii\base\Model::scenarios(). public string $createScenario = \yii\base\Model::SCENARIO_DEFAULT