You are here

public function ResourceObjectData::getOmissions in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/jsonapi/src/JsonApiResource/ResourceObjectData.php \Drupal\jsonapi\JsonApiResource\ResourceObjectData::getOmissions()

Gets only data to be omitted.

Return value

static

Overrides TopLevelDataInterface::getOmissions

File

core/modules/jsonapi/src/JsonApiResource/ResourceObjectData.php, line 61

Class

ResourceObjectData
Represents the primary data for individual and collection documents.

Namespace

Drupal\jsonapi\JsonApiResource

Code

public function getOmissions() {
  $omitted_data = [];
  foreach ($this->data as $resource_object) {
    if ($resource_object instanceof EntityAccessDeniedHttpException) {
      $omitted_data[] = $resource_object;
    }
  }
  return new OmittedData($omitted_data);
}