function CacheableNormalization::omitIfEmpty

Same name and namespace in other branches
  1. 9 core/modules/jsonapi/src/Normalizer/Value/CacheableNormalization.php \Drupal\jsonapi\Normalizer\Value\CacheableNormalization::omitIfEmpty()
  2. 10 core/modules/jsonapi/src/Normalizer/Value/CacheableNormalization.php \Drupal\jsonapi\Normalizer\Value\CacheableNormalization::omitIfEmpty()
  3. 11.x core/modules/jsonapi/src/Normalizer/Value/CacheableNormalization.php \Drupal\jsonapi\Normalizer\Value\CacheableNormalization::omitIfEmpty()

Converts the object to a CacheableOmission if the normalization is empty.

Return value

self|\Drupal\jsonapi\Normalizer\Value\CacheableOmission A CacheableOmission if the normalization is considered empty, self otherwise.

File

core/modules/jsonapi/src/Normalizer/Value/CacheableNormalization.php, line 76

Class

CacheableNormalization
Use to store normalized data and its cacheability.

Namespace

Drupal\jsonapi\Normalizer\Value

Code

public function omitIfEmpty() {
    return empty($this->normalization) ? new CacheableOmission($this) : $this;
}

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