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

Breadcrumb

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

class CacheableOmission

Represents the cacheability associated with the omission of a value.

@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 \Drupal\jsonapi\Normalizer\Value\TemporaryArrayObjectThrowingExceptions extends \Drupal\jsonapi\Normalizer\Value\ArrayObject
    • class \Drupal\jsonapi\Normalizer\Value\CacheableNormalization extends \Drupal\jsonapi\Normalizer\Value\TemporaryArrayObjectThrowingExceptions implements \Drupal\Core\Cache\CacheableDependencyInterface uses \Drupal\Core\Cache\CacheableDependencyTrait
      • class \Drupal\jsonapi\Normalizer\Value\CacheableOmission extends \Drupal\jsonapi\Normalizer\Value\CacheableNormalization

Expanded class hierarchy of CacheableOmission

See also

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

jsonapi.api.php

3 files declare their use of CacheableOmission
JsonApiDocumentTopLevelNormalizer.php in core/modules/jsonapi/src/Normalizer/JsonApiDocumentTopLevelNormalizer.php
LinkCollectionNormalizer.php in core/modules/jsonapi/src/Normalizer/LinkCollectionNormalizer.php
ResourceObjectNormalizer.php in core/modules/jsonapi/src/Normalizer/ResourceObjectNormalizer.php

File

core/modules/jsonapi/src/Normalizer/Value/CacheableOmission.php, line 16

Namespace

Drupal\jsonapi\Normalizer\Value
View source
final class CacheableOmission extends CacheableNormalization {
    
    /**
     * CacheableOmission constructor.
     *
     * @param \Drupal\Core\Cache\CacheableDependencyInterface $cacheability
     *   Cacheability related to the omission of the normalization. For example,
     *   if a field is omitted because of an access result that varies by the
     *   `user.permissions` cache context, we need to associate that information
     *   with the response so that it will appear for a user *with* the
     *   appropriate permissions for that field.
     */
    public function __construct(CacheableDependencyInterface $cacheability) {
        parent::__construct($cacheability, NULL);
    }
    
    /**
     * {@inheritdoc}
     */
    public static function permanent($no_op = NULL) {
        return parent::permanent(NULL);
    }
    
    /**
     * A CacheableOmission should never have its normalization retrieved.
     */
    public function getNormalization() {
        throw new \LogicException('A CacheableOmission should never have its normalization retrieved.');
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
CacheableDependencyTrait::$cacheContexts protected property Cache contexts.
CacheableDependencyTrait::$cacheMaxAge protected property Cache max-age.
CacheableDependencyTrait::$cacheTags protected property Cache tags.
CacheableDependencyTrait::getCacheContexts public function 4
CacheableDependencyTrait::getCacheMaxAge public function 4
CacheableDependencyTrait::getCacheTags public function 4
CacheableDependencyTrait::setCacheability protected function Sets cacheability; useful for value object constructors.
CacheableNormalization::$normalization protected property A normalized value.
CacheableNormalization::aggregate public static function Collects an array of CacheableNormalizations into a single instance.
CacheableNormalization::hasNoNestedInstances protected static function Ensures that no nested values are instances of this class.
CacheableNormalization::omitIfEmpty public function Converts the object to a CacheableOmission if the normalization is empty.
CacheableNormalization::withCacheableDependency public function Gets a new CacheableNormalization with an additional dependency.
CacheableOmission::getNormalization public function A CacheableOmission should never have its normalization retrieved. Overrides CacheableNormalization::getNormalization
CacheableOmission::permanent public static function Creates a CacheableNormalization instance without any special cacheability. Overrides CacheableNormalization::permanent
CacheableOmission::__construct public function CacheableOmission constructor. Overrides CacheableNormalization::__construct
TemporaryArrayObjectThrowingExceptions::append public function Append a value to the ArrayObject.
TemporaryArrayObjectThrowingExceptions::asort public function Sort the ArrayObject.
TemporaryArrayObjectThrowingExceptions::count public function Count the ArrayObject.
TemporaryArrayObjectThrowingExceptions::exchangeArray public function Exchange the current array with another array or object.
TemporaryArrayObjectThrowingExceptions::getArrayCopy public function Exports the \ArrayObject to an array.
TemporaryArrayObjectThrowingExceptions::getFlags public function Gets the behavior flags of the \ArrayObject.
TemporaryArrayObjectThrowingExceptions::getIterator public function Create a new iterator from an ArrayObject instance.
TemporaryArrayObjectThrowingExceptions::getIteratorClass public function Gets the class name of the array iterator that is used by \ArrayObject::getIterator().
TemporaryArrayObjectThrowingExceptions::ksort public function Sort the entries by key.
TemporaryArrayObjectThrowingExceptions::natcasesort public function Sort an array using a case insensitive "natural order" algorithm.
TemporaryArrayObjectThrowingExceptions::natsort public function Sort entries using a "natural order" algorithm.
TemporaryArrayObjectThrowingExceptions::offsetExists public function Returns whether the requested index exists.
TemporaryArrayObjectThrowingExceptions::offsetGet public function Returns the value at the specified index.
TemporaryArrayObjectThrowingExceptions::offsetSet public function Sets the value at the specified index to new value.
TemporaryArrayObjectThrowingExceptions::offsetUnset public function Unsets the value at the specified index.
TemporaryArrayObjectThrowingExceptions::setFlags public function Sets the behavior flags for the \ArrayObject.
TemporaryArrayObjectThrowingExceptions::setIteratorClass public function Sets the iterator classname for the \ArrayObject.
TemporaryArrayObjectThrowingExceptions::uasort public function Sort the entries with a user-defined comparison function.
TemporaryArrayObjectThrowingExceptions::uksort public function Sort the entries by keys using a user-defined comparison function.

API Navigation

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