You are here

class ModifiedResourceResponse in Drupal 8

Same name and namespace in other branches
  1. 9 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

Namesort descending Modifiers Type Description Overrides
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.