Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. EntityResource.php

function 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\Controller

Code

protected function entityExists(EntityInterface $entity) {
    $entity_storage = $this->entityTypeManager
        ->getStorage($entity->getEntityTypeId());
    return !empty($entity_storage->loadByProperties([
        'uuid' => $entity->uuid(),
    ]));
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal