public function IncludeOnlyRelationshipNormalizerValue::__construct in JSON:API 8
Instantiate a IncludeOnlyRelationshipNormalizerValue object.
Parameters
\Drupal\jsonapi\Normalizer\Value\RelationshipNormalizerValue $relationship_normalizer_value: The relationship normalizer value to convert into an include-only one.
Overrides FieldNormalizerValue::__construct
File
- src/
Normalizer/ Value/ IncludeOnlyRelationshipNormalizerValue.php, line 24
Class
- IncludeOnlyRelationshipNormalizerValue
- Helps normalize relationships in compliance with the JSON API spec.
Namespace
Drupal\jsonapi\Normalizer\ValueCode
public function __construct(RelationshipNormalizerValue $relationship_normalizer_value) {
assert(!empty($relationship_normalizer_value
->getIncludes()), sprintf('%s should only be used for relationships that do have includes.', get_called_class()));
parent::__construct(AccessResult::allowed(), [], NULL, 'relationships');
$this->includes = $relationship_normalizer_value
->getIncludes();
$this
->setCacheability($relationship_normalizer_value);
}