function ResourceObjectData::getOmissions

Same name in other branches
  1. 8.9.x core/modules/jsonapi/src/JsonApiResource/ResourceObjectData.php \Drupal\jsonapi\JsonApiResource\ResourceObjectData::getOmissions()
  2. 10 core/modules/jsonapi/src/JsonApiResource/ResourceObjectData.php \Drupal\jsonapi\JsonApiResource\ResourceObjectData::getOmissions()
  3. 11.x 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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.