You are here

public function ResourceObjectNormalizationCacher::onTerminate in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/jsonapi/src/EventSubscriber/ResourceObjectNormalizationCacher.php \Drupal\jsonapi\EventSubscriber\ResourceObjectNormalizationCacher::onTerminate()

Writes normalizations of entities to cache, if any were created.

Parameters

\Symfony\Component\HttpKernel\Event\PostResponseEvent $event: The Event to process.

File

core/modules/jsonapi/src/EventSubscriber/ResourceObjectNormalizationCacher.php, line 111

Class

ResourceObjectNormalizationCacher
Caches entity normalizations after the response has been sent.

Namespace

Drupal\jsonapi\EventSubscriber

Code

public function onTerminate(PostResponseEvent $event) {
  foreach ($this->toCache as $value) {
    list($object, $normalization_parts) = $value;
    $this
      ->set($object, $normalization_parts);
  }
}