You are here

protected function Tables::ensureEntityTable in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Entity/Query/Sql/Tables.php \Drupal\Core\Entity\Query\Sql\Tables::ensureEntityTable()

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

Parameters

string $property:

Return value

string

Throws

\Drupal\Core\Entity\Query\QueryException

1 call to Tables::ensureEntityTable()
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 243
Contains \Drupal\Core\Entity\Query\Sql\Tables.

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");
}