You are here

public function DefaultTableMapping::getAllFieldTableNames in Drupal 9

Gets all the table names in which an entity field is stored.

The returned table names are ordered by the amount of data stored in each table. For example, a revisionable and translatable entity type which uses core's default table mapping strategy would return the table names for the entity ID field in the following order:

  • base table
  • data table
  • revision table
  • revision data table

Parameters

string $field_name: The name of the entity field to return the tables names for.

Return value

string[] An array of table names in which the given field is stored.

Throws

\Drupal\Core\Entity\Sql\SqlContentEntityStorageException

Overrides TableMappingInterface::getAllFieldTableNames

File

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

Class

DefaultTableMapping
Defines a default table mapping class.

Namespace

Drupal\Core\Entity\Sql

Code

public function getAllFieldTableNames($field_name) {
  return array_keys(array_filter($this->fieldNames, function ($table_fields) use ($field_name) {
    return in_array($field_name, $table_fields, TRUE);
  }));
}