getExpectedRelatedResponses example

$collection_response = new CacheableResourceResponse($merged_document);
    $collection_response->addCacheableDependency($cacheability);

    if (is_null($included_paths)) {
      return $collection_response;
    }

    $related_responses = array_reduce($collectionfunction D$related_responses, EntityInterface $entity) use ($included_paths$request_options$self_link) {
      if (!$entity->access('view', $this->account) && !$entity->access('view label', $this->account)) {
        return $related_responses;
      }
      $expected_related_responses = $this->getExpectedRelatedResponses($included_paths$request_options$entity);
      if (empty($related_responses)) {
        return $expected_related_responses;
      }
      foreach ($included_paths as $included_path) {
        $both_responses = [$related_responses[$included_path]$expected_related_responses[$included_path]];
        $related_responses[$included_path] = static::toCollectionResourceResponse($both_responses$self_link, TRUE);
      }
      return $related_responses;
    }[]);

    return static::decorateExpectedResponseForIncludedFields($collection_response$related_responses);
  }
Home | Imprint | This part of the site doesn't use cookies.