protected function SqlContentEntityStorageSchema::checkEntityType

protected SqlContentEntityStorageSchema::checkEntityType(EntityTypeInterface $entity_type)

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

File

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

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

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!Sql!SqlContentEntityStorageSchema.php/function/SqlContentEntityStorageSchema::checkEntityType/8.1.x