function EntityResource::entityExists
Same name in other branches
- 8.9.x core/modules/jsonapi/src/Controller/EntityResource.php \Drupal\jsonapi\Controller\EntityResource::entityExists()
- 10 core/modules/jsonapi/src/Controller/EntityResource.php \Drupal\jsonapi\Controller\EntityResource::entityExists()
- 11.x core/modules/jsonapi/src/Controller/EntityResource.php \Drupal\jsonapi\Controller\EntityResource::entityExists()
Checks if the given entity exists.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity for which to test existence.
Return value
bool Whether the entity already has been created.
1 call to EntityResource::entityExists()
- EntityResource::createIndividual in core/
modules/ jsonapi/ src/ Controller/ EntityResource.php - Creates an individual entity.
File
-
core/
modules/ jsonapi/ src/ Controller/ EntityResource.php, line 1218
Class
- EntityResource
- Process all entity requests.
Namespace
Drupal\jsonapi\ControllerCode
protected function entityExists(EntityInterface $entity) {
$entity_storage = $this->entityTypeManager
->getStorage($entity->getEntityTypeId());
return !empty($entity_storage->loadByProperties([
'uuid' => $entity->uuid(),
]));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.