function SqlContentEntityStorageSchema::deleteDedicatedTableSchema

Same name in other branches
  1. 9 core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::deleteDedicatedTableSchema()
  2. 10 core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::deleteDedicatedTableSchema()
  3. 11.x 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.

File

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

Class

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

Namespace

Drupal\Core\Entity\Sql

Code

protected function deleteDedicatedTableSchema(FieldStorageDefinitionInterface $storage_definition) {
    $table_mapping = $this->getTableMapping($this->entityType, [
        $storage_definition,
    ]);
    $table_name = $table_mapping->getDedicatedDataTableName($storage_definition, $storage_definition->isDeleted());
    if ($this->database
        ->schema()
        ->tableExists($table_name)) {
        $this->database
            ->schema()
            ->dropTable($table_name);
    }
    if ($this->entityType
        ->isRevisionable()) {
        $revision_table_name = $table_mapping->getDedicatedRevisionTableName($storage_definition, $storage_definition->isDeleted());
        if ($this->database
            ->schema()
            ->tableExists($revision_table_name)) {
            $this->database
                ->schema()
                ->dropTable($revision_table_name);
        }
    }
    $this->deleteFieldSchemaData($storage_definition);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.