function DefaultTableMapping::getColumnNames

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

Overrides TableMappingInterface::getColumnNames

1 call to DefaultTableMapping::getColumnNames()
DefaultTableMapping::getAllColumns in core/lib/Drupal/Core/Entity/Sql/DefaultTableMapping.php
Gets a list of all database columns for a given table.

File

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

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] = [];
        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];
}

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