public function SqlContentEntityStorage::onFieldStorageDefinitionDelete
public SqlContentEntityStorage::onFieldStorageDefinitionDelete(FieldStorageDefinitionInterface $storage_definition)
Reacts to the deletion of a field storage definition.
Parameters
\Drupal\Core\Field\FieldStorageDefinitionInterface $storage_definition: The field being deleted.
Overrides ContentEntityStorageBase::onFieldStorageDefinitionDelete
File
- core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php, line 1413
Class
- SqlContentEntityStorage
- A content entity database storage implementation.
Namespace
Drupal\Core\Entity\SqlCode
public function onFieldStorageDefinitionDelete(FieldStorageDefinitionInterface $storage_definition) { $table_mapping = $this->getTableMapping( $this->entityManager->getLastInstalledFieldStorageDefinitions($this->entityType->id()) ); // @todo Remove the FieldStorageConfigInterface check when non-configurable // fields support purging: https://www.drupal.org/node/2282119. if ($storage_definition instanceof FieldStorageConfigInterface && $table_mapping->requiresDedicatedTableStorage($storage_definition)) { // Mark all data associated with the field for deletion. $table = $table_mapping->getDedicatedDataTableName($storage_definition); $revision_table = $table_mapping->getDedicatedRevisionTableName($storage_definition); $this->database->update($table) ->fields(array('deleted' => 1)) ->execute(); if ($this->entityType->isRevisionable()) { $this->database->update($revision_table) ->fields(array('deleted' => 1)) ->execute(); } } // Update the field schema. $this->wrapSchemaException(function() use ($storage_definition) { $this->getStorageSchema()->onFieldStorageDefinitionDelete($storage_definition); }); }
© 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::onFieldStorageDefinitionDelete/8.1.x