yii\rest\Controller::afterAction PHP Method

afterAction() public method

public afterAction ( $action, $result )
    public function afterAction($action, $result)
    {
        $result = parent::afterAction($action, $result);
        return $this->serializeData($result);
    }

Usage Example

Esempio n. 1
0
 /**
  * @inheritdoc
  * Fix Yii2 Bug #5665: The `currentPage` meta data in the RESTful result should be 1-based, similar to that in HTTP headers
  * There is a similar fix in backend\components\rest\RestController.php
  */
 public function afterAction($action, $result)
 {
     $result = parent::afterAction($action, $result);
     $fixActions = ['message-history'];
     if (in_array($action->id, $fixActions) && isset($result['_meta']['currentPage'])) {
         $result['_meta']['currentPage']++;
     }
     return $result;
 }
All Usage Examples Of yii\rest\Controller::afterAction