EntityTypeListener::onEntityTypeUpdate

public EntityTypeListener::onEntityTypeUpdate(EntityTypeInterface $entity_type, EntityTypeInterface $original)

Reacts to the update of the entity type.

Parameters

\Drupal\Core\Entity\EntityTypeInterface $entity_type: The updated entity type definition.

\Drupal\Core\Entity\EntityTypeInterface $original: The original entity type definition.

Overrides EntityTypeListenerInterface::onEntityTypeUpdate

File

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

Class

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

Namespace

Drupal\Core\Entity

Code

public function onEntityTypeUpdate(EntityTypeInterface $entity_type, EntityTypeInterface $original) {
  $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->onEntityTypeUpdate($entity_type, $original);
  }

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

  $this->entityLastInstalledSchemaRepository->setLastInstalledDefinition($entity_type);
}
doc_Drupal
2016-10-29 09:08:32
Comments
Leave a Comment

Please login to continue.