protected function 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 drupal/core/modules/field_sql_storage/lib/Drupal/field_sql_storage/Entity/Tables.php

File

drupal/core/modules/field_sql_storage/lib/Drupal/field_sql_storage/Entity/Tables.php, line 222
Definition of Drupal\field_sql_storage\Entity\Tables.

Class

Tables
Adds tables and fields to the SQL entity query.

Namespace

Drupal\field_sql_storage\Entity

Code

protected function ensureEntityTable($index_prefix, $property, $type, $langcode, $base_table, $id_field, $entity_tables) {
  foreach ($entity_tables as $table => $schema) {
    if (isset($schema['fields'][$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(format_string('@property not found', array(
    '@property' => $property,
  )));
}