function SqlContentEntityStorageSchema::checkEntityType

Same name in other branches
  1. 9 core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::checkEntityType()
  2. 8.9.x core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::checkEntityType()
  3. 10 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 915

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.