protected function Tables::getTableMapping

protected Tables::getTableMapping($table, $entity_type_id)

Gets the schema for the given table.

Parameters

string $table: The table name.

Return value

array|bool The table field mapping for the given table or FALSE if not available.

File

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

Class

Tables
Adds tables and fields to the SQL entity query.

Namespace

Drupal\Core\Entity\Query\Sql

Code

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

© 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!Query!Sql!Tables.php/function/Tables::getTableMapping/8.1.x