You are here

protected function SqlContentEntityStorageSchema::deleteDedicatedTableSchema in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::deleteDedicatedTableSchema()

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.

1 call to SqlContentEntityStorageSchema::deleteDedicatedTableSchema()
SqlContentEntityStorageSchema::onEntityTypeDelete in core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php
Reacts to the deletion of the entity type.

File

core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php, line 1186
Contains \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema.

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);
}