function DefaultTableMapping::getAllColumns

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

Overrides TableMappingInterface::getAllColumns

1 call to DefaultTableMapping::getAllColumns()
DefaultTableMapping::getFieldTableName in core/lib/Drupal/Core/Entity/Sql/DefaultTableMapping.php
Gets the table name for a given column.

File

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

Class

DefaultTableMapping
Defines a default table mapping class.

Namespace

Drupal\Core\Entity\Sql

Code

public function getAllColumns($table_name) {
    if (!isset($this->allColumns[$table_name])) {
        $this->allColumns[$table_name] = [];
        foreach ($this->getFieldNames($table_name) as $field_name) {
            $this->allColumns[$table_name] = array_merge($this->allColumns[$table_name], array_values($this->getColumnNames($field_name)));
        }
        // There is just one field for each dedicated storage table, thus
        // $field_name can only refer to it.
        if (isset($field_name) && $this->requiresDedicatedTableStorage($this->fieldStorageDefinitions[$field_name])) {
            // Unlike in shared storage tables, in dedicated ones field columns are
            // positioned last.
            $this->allColumns[$table_name] = array_merge($this->getExtraColumns($table_name), $this->allColumns[$table_name]);
        }
        else {
            $this->allColumns[$table_name] = array_merge($this->allColumns[$table_name], $this->getExtraColumns($table_name));
        }
    }
    return $this->allColumns[$table_name];
}

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