SqlContentEntityStorageSchema::deleteDedicatedTableSchema

protected SqlContentEntityStorageSchema::deleteDedicatedTableSchema(FieldStorageDefinitionInterface $storage_definition)

Deletes the schema for a field stored in a dedicated table.

Parameters

\Drupal\Core\Field\FieldStorageDefinitionInterface $storage_definition: The storage definition of the field being deleted.

File

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

Class

SqlContentEntityStorageSchema
Defines a schema handler that supports revisionable, translatable entities.

Namespace

Drupal\Core\Entity\Sql

Code

protected function deleteDedicatedTableSchema(FieldStorageDefinitionInterface $storage_definition) {
  // When switching from dedicated to shared field table layout we need need
  // to delete the field tables with their regular names. When this happens
  // original definitions will be defined.
  $deleted = !$this->originalDefinitions;
  $table_mapping = $this->storage->getTableMapping();
  $table_name = $table_mapping->getDedicatedDataTableName($storage_definition, $deleted);
  $this->database->schema()->dropTable($table_name);
  if ($this->entityType->isRevisionable()) {
    $revision_name = $table_mapping->getDedicatedRevisionTableName($storage_definition, $deleted);
    $this->database->schema()->dropTable($revision_name);
  }
  $this->deleteFieldSchemaData($storage_definition);
}
doc_Drupal
2016-10-29 09:43:36
Comments
Leave a Comment

Please login to continue.