function LabelOnlyResourceObject::createFromEntity
Overrides ResourceObject::createFromEntity
1 call to LabelOnlyResourceObject::createFromEntity()
- EntityAccessChecker::getAccessCheckedResourceObject in core/
modules/ jsonapi/ src/ Access/ EntityAccessChecker.php - Get the object to normalize and the access based on the provided entity.
File
-
core/
modules/ jsonapi/ src/ JsonApiResource/ LabelOnlyResourceObject.php, line 30
Class
- LabelOnlyResourceObject
- Value object decorating a ResourceObject; only its label is available.
Namespace
Drupal\jsonapi\JsonApiResourceCode
public static function createFromEntity(ResourceType $resource_type, EntityInterface $entity, ?LinkCollection $links = NULL) {
$resource_object = new static($entity, $resource_type, $entity->uuid(), $resource_type->isVersionable() && $entity instanceof RevisionableInterface ? $entity->getRevisionId() : NULL, static::extractFieldsFromEntity($resource_type, $entity), static::buildLinksFromEntity($resource_type, $entity, $links ?: new LinkCollection([])));
$resource_object->setEntity($entity);
return $resource_object;
}