public function DefaultTableMapping::getColumnNames

public DefaultTableMapping::getColumnNames($field_name)

Gets a mapping of field columns to database columns for a given field.

Parameters

string $field_name: The name of the entity field to return the column mapping for.

Return value

string[] The keys of this array are the keys of the array returned by FieldStorageDefinitionInterface::getColumns() while the respective values are the names of the database columns for this table mapping.

Overrides TableMappingInterface::getColumnNames

File

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

Class

DefaultTableMapping
Defines a default table mapping class.

Namespace

Drupal\Core\Entity\Sql

Code

public function getColumnNames($field_name) {
  if (!isset($this->columnMapping[$field_name])) {
    $this->columnMapping[$field_name] = array();
    if (isset($this->fieldStorageDefinitions[$field_name]) && !$this->fieldStorageDefinitions[$field_name]->hasCustomStorage()) {
      foreach (array_keys($this->fieldStorageDefinitions[$field_name]->getColumns()) as $property_name) {
        $this->columnMapping[$field_name][$property_name] = $this->getFieldColumnName($this->fieldStorageDefinitions[$field_name], $property_name);
      }
    }
  }
  return $this->columnMapping[$field_name];
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!Sql!DefaultTableMapping.php/function/DefaultTableMapping::getColumnNames/8.1.x