public function EntityTypeListener::onEntityTypeDelete

public EntityTypeListener::onEntityTypeDelete(EntityTypeInterface $entity_type)

Reacts to the deletion of the entity type.

Parameters

\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type being deleted.

Overrides EntityTypeListenerInterface::onEntityTypeDelete

File

core/lib/Drupal/Core/Entity/EntityTypeListener.php, line 103

Class

EntityTypeListener
Reacts to entity type CRUD on behalf of the Entity system.

Namespace

Drupal\Core\Entity

Code

public function onEntityTypeDelete(EntityTypeInterface $entity_type) {
  $entity_type_id = $entity_type->id();

  // @todo Forward this to all interested handlers, not only storage, once
  //   iterating handlers is possible: https://www.drupal.org/node/2332857.
  $storage = $this->entityTypeManager->getStorage($entity_type_id);
  if ($storage instanceof EntityTypeListenerInterface) {
    $storage->onEntityTypeDelete($entity_type);
  }

  $this->eventDispatcher->dispatch(EntityTypeEvents::DELETE, new EntityTypeEvent($entity_type));

  $this->entityLastInstalledSchemaRepository->deleteLastInstalledDefinition($entity_type_id);
}

© 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!EntityTypeListener.php/function/EntityTypeListener::onEntityTypeDelete/8.1.x