You are here

protected function SqlContentEntityStorageSchema::getTableMapping in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::getTableMapping()
  2. 9 core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::getTableMapping()

Refreshes the table mapping with updated definitions.

Parameters

\Drupal\Core\Entity\EntityTypeInterface $entity_type: An entity type definition.

\Drupal\Core\Field\FieldStorageDefinitionInterface[]|null $storage_definitions: (optional) An array of field storage definitions. Defaults to the last installed field storage definition.

Return value

\Drupal\Core\Entity\Sql\DefaultTableMapping A table mapping object.

17 calls to SqlContentEntityStorageSchema::getTableMapping()
SqlContentEntityStorageSchema::createEntitySchemaIndexes in core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php
Creates the specified entity schema indexes and keys.
SqlContentEntityStorageSchema::createSharedTableSchema in core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php
Creates the schema for a field stored in a shared table.
SqlContentEntityStorageSchema::deleteDedicatedTableSchema in core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php
Deletes the schema for a field stored in a dedicated table.
SqlContentEntityStorageSchema::deleteEntitySchemaIndexes in core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php
Deletes the specified entity schema indexes and keys.
SqlContentEntityStorageSchema::deleteSharedTableSchema in core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php
Deletes the schema for a field stored in a shared table.

... See full list

File

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

Class

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

Namespace

Drupal\Core\Entity\Sql

Code

protected function getTableMapping(EntityTypeInterface $entity_type, array $storage_definitions = NULL) {

  // Allow passing a single field storage definition when updating a field.
  if ($storage_definitions && count($storage_definitions) === 1) {
    $storage_definition = reset($storage_definitions);
    $field_storage_definitions = [
      $storage_definition
        ->getName() => $storage_definition,
    ] + $this->fieldStorageDefinitions;
  }
  else {
    $field_storage_definitions = $storage_definitions ?: $this->fieldStorageDefinitions;
  }
  return $this->storage
    ->getCustomTableMapping($entity_type, $field_storage_definitions);
}