protected function Tables::ensureEntityTable

protected Tables::ensureEntityTable($index_prefix, $property, $type, $langcode, $base_table, $id_field, $entity_tables)

Join entity table if necessary and return the alias for it.

Parameters

string $property:

Return value

string

Throws

\Drupal\Core\Entity\Query\QueryException

File

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

Class

Tables
Adds tables and fields to the SQL entity query.

Namespace

Drupal\Core\Entity\Query\Sql

Code

protected function ensureEntityTable($index_prefix, $property, $type, $langcode, $base_table, $id_field, $entity_tables) {
  foreach ($entity_tables as $table => $mapping) {
    if (isset($mapping[$property])) {
      if (!isset($this->entityTables[$index_prefix . $table])) {
        $this->entityTables[$index_prefix . $table] = $this->addJoin($type, $table, "%alias.$id_field = $base_table.$id_field", $langcode);
      }
      return $this->entityTables[$index_prefix . $table];
    }
  }
  throw new QueryException("'$property' not found");
}

© 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::ensureEntityTable/8.1.x