Problem/Motivation

Original issue: #3516034: Add cacheable metadata to SelectInterface and entity QueryInterface objects

We allowed queries to carry cacheable metadata. With that change, it was no longer necessary to execute the query in a render context to capture whatever cacheability may have been added to it, because we can now get that information directly from the query.

Effectively, the following code was changed:

protected function executeQueryInRenderContext(QueryInterface $query, CacheableMetadata $query_cacheability) {
  $context = new RenderContext();
  $results = $this->renderer->executeInRenderContext($context, function () use ($query) {
    return $query->execute();
   });
  if (!$context->isEmpty()) {
    $query_cacheability->addCacheableDependency($context->pop());
   }
  return $results;
}

// BECAME

protected function executeQueryInRenderContext(QueryInterface $query, CacheableMetadata $query_cacheability) {
  return $query->execute($query_cacheability);
}

Which means the method name no longer makes sense and it can easily be inlined. Let's do that here.

Steps to reproduce

N/A

Proposed resolution

N/A

Remaining tasks

Remove and inline \Drupal\jsonapi\Controller\EntityResource::executeQueryInRenderContext()

User interface changes

N/A

Introduced terminology

N/A

API changes

Technically, none? The method was protected and no overrides exist in core. Still, to be verified.

Data model changes

N/A

Release notes snippet

N/A

Comments

kristiaanvandeneynde created an issue.