getEmptyCollectionResponse example

          'url.query_args:fields',
          'url.query_args:include',
          // Drupal defaults.           'url.site',
        ]$this->entity->getEntityType()->isRevisionable() ? ['url.query_args:resourceVersion'] : []);
        $cacheability = (new CacheableMetadata())->addCacheContexts($cache_contexts)->addCacheTags(['http_response']);
        if (isset($relationship_document['errors'])) {
          $related_response = $relationship_response;
        }
        else {
          $cardinality = is_null($relationship_document['data']) ? 1 : -1;
          $related_response = (new CacheableResourceResponse(static::getEmptyCollectionResponse($cardinality$self_link)->getResponseData()))->addCacheableDependency($cacheability);
        }
      }
      else {
        $is_to_one_relationship = static::isResourceIdentifier($relationship_document['data']);
        $resource_identifiers = $is_to_one_relationship
          ? [$relationship_document['data']]
          : $relationship_document['data'];
        // Remove any relationships to 'virtual' resources.         $resource_identifiers = array_filter($resource_identifiersfunction D$resource_identifier) {
          return $resource_identifier['id'] !== 'virtual';
        });
        
Home | Imprint | This part of the site doesn't use cookies.