Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Tables.php

function Tables::getTableMapping

Gets the schema for the given table.

Parameters

string $table: The table name.

string $entity_type_id: The entity type ID.

Return value

array|false An associative array of table field mappings for the given table, keyed by column name and where values are incrementing integers. If the table mapping is not available, then FALSE is returned.

1 call to Tables::getTableMapping()
Tables::addField in core/lib/Drupal/Core/Entity/Query/Sql/Tables.php
Adds a field to a database query.

File

core/lib/Drupal/Core/Entity/Query/Sql/Tables.php, line 469

Class

Tables
Adds database tables and fields to the SQL entity query.

Namespace

Drupal\Core\Entity\Query\Sql

Code

protected function getTableMapping($table, $entity_type_id) {
    $storage = $this->entityTypeManager
        ->getStorage($entity_type_id);
    if ($storage instanceof SqlEntityStorageInterface) {
        $mapping = $storage->getTableMapping()
            ->getAllColumns($table);
    }
    else {
        return FALSE;
    }
    return array_flip($mapping);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal