function DefaultTableMapping::getDedicatedDataTableName

Same name in other branches
  1. 9 core/lib/Drupal/Core/Entity/Sql/DefaultTableMapping.php \Drupal\Core\Entity\Sql\DefaultTableMapping::getDedicatedDataTableName()
  2. 8.9.x core/lib/Drupal/Core/Entity/Sql/DefaultTableMapping.php \Drupal\Core\Entity\Sql\DefaultTableMapping::getDedicatedDataTableName()
  3. 11.x core/lib/Drupal/Core/Entity/Sql/DefaultTableMapping.php \Drupal\Core\Entity\Sql\DefaultTableMapping::getDedicatedDataTableName()

Generates a table name for a field data table.

Parameters

\Drupal\Core\Field\FieldStorageDefinitionInterface $storage_definition: The field storage definition.

bool $is_deleted: (optional) Whether the table name holding the values of a deleted field should be returned.

Return value

string A string containing the generated name for the database table.

1 call to DefaultTableMapping::getDedicatedDataTableName()
DefaultTableMapping::getFieldTableName in core/lib/Drupal/Core/Entity/Sql/DefaultTableMapping.php
Gets the table name for a given column.

File

core/lib/Drupal/Core/Entity/Sql/DefaultTableMapping.php, line 566

Class

DefaultTableMapping
Defines a default table mapping class.

Namespace

Drupal\Core\Entity\Sql

Code

public function getDedicatedDataTableName(FieldStorageDefinitionInterface $storage_definition, $is_deleted = FALSE) {
    if ($is_deleted) {
        // When a field is a deleted, the table is renamed to
        // {field_deleted_data_UNIQUE_STORAGE_ID}. To make sure we don't end up
        // with table names longer than 64 characters, we hash the unique storage
        // identifier and return the first 10 characters so we end up with a short
        // unique ID.
        return "field_deleted_data_" . substr(hash('sha256', $storage_definition->getUniqueStorageIdentifier()), 0, 10);
    }
    else {
        return $this->generateFieldTableName($storage_definition, FALSE);
    }
}

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