class ModifiedResourceResponse

Same name in other branches
  1. 8.9.x core/modules/rest/src/ModifiedResourceResponse.php \Drupal\rest\ModifiedResourceResponse
  2. 10 core/modules/rest/src/ModifiedResourceResponse.php \Drupal\rest\ModifiedResourceResponse
  3. 11.x core/modules/rest/src/ModifiedResourceResponse.php \Drupal\rest\ModifiedResourceResponse

A response that does not contain cacheability metadata.

Used when resources are modified by a request: responses to unsafe requests (POST/PATCH/DELETE) can never be cached.

Hierarchy

Expanded class hierarchy of ModifiedResourceResponse

See also

\Drupal\rest\ResourceResponse

4 files declare their use of ModifiedResourceResponse
EntityResource.php in core/modules/rest/src/Plugin/rest/resource/EntityResource.php
FileUploadResource.php in core/modules/file/src/Plugin/rest/resource/FileUploadResource.php
ResourceResponseSubscriberTest.php in core/modules/rest/tests/src/Unit/EventSubscriber/ResourceResponseSubscriberTest.php
UserRegistrationResource.php in core/modules/user/src/Plugin/rest/resource/UserRegistrationResource.php

File

core/modules/rest/src/ModifiedResourceResponse.php, line 15

Namespace

Drupal\rest
View source
class ModifiedResourceResponse extends Response implements ResourceResponseInterface {
    use ResourceResponseTrait;
    
    /**
     * Constructor for ModifiedResourceResponse objects.
     *
     * @param mixed $data
     *   Response data that should be serialized.
     * @param int $status
     *   The response status code.
     * @param array $headers
     *   An array of response headers.
     */
    public function __construct($data = NULL, $status = 200, $headers = []) {
        $this->responseData = $data;
        parent::__construct('', $status, $headers);
    }

}

Members

Title Sort descending Modifiers Object type Summary
ModifiedResourceResponse::__construct public function Constructor for ModifiedResourceResponse objects.
ResourceResponseTrait::$responseData protected property Response data that should be serialized.
ResourceResponseTrait::getResponseData public function Returns response data that should be serialized.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.