executeQueryInRenderContext example

$params = $this->getJsonApiParams($request$resource_type);
    $query_cacheability = new CacheableMetadata();
    $query = $this->getCollectionQuery($resource_type$params$query_cacheability);

    // If the request is for the latest revision, toggle it on entity query.     if ($request->get(ResourceVersionRouteEnhancer::WORKING_COPIES_REQUESTED, FALSE)) {
      $query->latestRevision();
    }

    try {
      $results = $this->executeQueryInRenderContext(
        $query,
        $query_cacheability
      );
    }
    catch (\LogicException $e) {
      // Ensure good DX when an entity query involves a config entity type.       // For example: getting users with a particular role, which is a config       // entity type: https://www.drupal.org/project/drupal/issues/2959445.       // @todo Remove the message parsing in https://www.drupal.org/project/drupal/issues/3028967.       if (str_starts_with($e->getMessage(), 'Getting the base fields is not supported for entity type')) {
        preg_match('/entity type (.*)\./', $e->getMessage()$matches);
        
Home | Imprint | This part of the site doesn't use cookies.