You are here

protected function SqlContentEntityStorageSchema::checkEntityType in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::checkEntityType()
  2. 9 core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::checkEntityType()

Checks that we are dealing with the correct entity type.

Parameters

\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type to be checked.

Return value

bool TRUE if the entity type matches the current one.

Throws

\Drupal\Core\Entity\EntityStorageException

4 calls to SqlContentEntityStorageSchema::checkEntityType()
SqlContentEntityStorageSchema::getEntitySchema in core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php
Gets the entity schema for the specified entity type.
SqlContentEntityStorageSchema::onEntityTypeDelete in core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php
Reacts to the deletion of the entity type.
SqlContentEntityStorageSchema::onEntityTypeUpdate in core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php
Reacts to the update of the entity type.
SqlContentEntityStorageSchema::onFieldableEntityTypeCreate in core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php
Reacts to the creation of the fieldable entity type.

File

core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php, line 912

Class

SqlContentEntityStorageSchema
Defines a schema handler that supports revisionable, translatable entities.

Namespace

Drupal\Core\Entity\Sql

Code

protected function checkEntityType(EntityTypeInterface $entity_type) {
  if ($entity_type
    ->id() != $this->entityType
    ->id()) {
    throw new EntityStorageException("Unsupported entity type {$entity_type->id()}");
  }
  return TRUE;
}