Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. CacheableResourceResponse.php

class CacheableResourceResponse

Extends ResourceResponse with cacheability.

We want to have the same functionality for both responses that are cacheable and those that are not. This response class should be used in all instances where the response is expected to be cacheable.

@internal JSON:API maintains no PHP API since its API is the HTTP API. This class may change at any time and this will break any dependencies on it.

Hierarchy

  • class \Symfony\Component\HttpFoundation\Response
    • class \Drupal\jsonapi\ResourceResponse extends \Symfony\Component\HttpFoundation\Response
      • class \Drupal\jsonapi\CacheableResourceResponse extends \Drupal\jsonapi\ResourceResponse implements \Drupal\Core\Cache\CacheableResponseInterface uses \Drupal\Core\Cache\CacheableResponseTrait

Expanded class hierarchy of CacheableResourceResponse

See also

https://www.drupal.org/project/drupal/issues/3032787

jsonapi.api.php

3 files declare their use of CacheableResourceResponse
DefaultExceptionSubscriber.php in core/modules/jsonapi/src/EventSubscriber/DefaultExceptionSubscriber.php
EntityResource.php in core/modules/jsonapi/src/Controller/EntityResource.php
EntryPoint.php in core/modules/jsonapi/src/Controller/EntryPoint.php

File

core/modules/jsonapi/src/CacheableResourceResponse.php, line 21

Namespace

Drupal\jsonapi
View source
class CacheableResourceResponse extends ResourceResponse implements CacheableResponseInterface {
    use CacheableResponseTrait;

}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal