function DefaultTableMapping::setFieldNames

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

Adds field columns for a table to the table mapping.

@internal

@todo Make this method protected in drupal:9.0.0.

Parameters

string $table_name: The name of the table to add the field column for.

string[] $field_names: A list of field names to add the columns for.

Return value

$this

See also

https://www.drupal.org/node/3067336

2 calls to DefaultTableMapping::setFieldNames()
TestDefaultTableMapping::setFieldNames in core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php
Adds field columns for a table to the table mapping.
TestSqlContentDefaultTableMapping::setFieldNames in core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageSchemaTest.php
Adds field columns for a table to the table mapping.
2 methods override DefaultTableMapping::setFieldNames()
TestDefaultTableMapping::setFieldNames in core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php
Adds field columns for a table to the table mapping.
TestSqlContentDefaultTableMapping::setFieldNames in core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageSchemaTest.php
Adds field columns for a table to the table mapping.

File

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

Class

DefaultTableMapping
Defines a default table mapping class.

Namespace

Drupal\Core\Entity\Sql

Code

public function setFieldNames($table_name, array $field_names) {
    $this->fieldNames[$table_name] = $field_names;
    // Force the re-computation of the column list.
    unset($this->allColumns[$table_name]);
    return $this;
}

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