W3cubDocs

/Drupal 8

public function SqlContentEntityStorage::onEntityTypeUpdate

public SqlContentEntityStorage::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/Sql/SqlContentEntityStorage.php, line 1363

Class

SqlContentEntityStorage
A content entity database storage implementation.

Namespace

Drupal\Core\Entity\Sql

Code

public function onEntityTypeUpdate(EntityTypeInterface $entity_type, EntityTypeInterface $original) {
  // Ensure we have an updated entity type definition.
  $this->entityType = $entity_type;
  // The table layout may have changed depending on the new entity type
  // definition.
  $this->initTableLayout();
  // Let the schema handler adapt to possible table layout changes.
  $this->wrapSchemaException(function() use ($entity_type, $original) {
    $this->getStorageSchema()->onEntityTypeUpdate($entity_type, $original);
  });
}

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