protected Tables::ensureFieldTable($index_prefix, &$field, $type, $langcode, $base_table, $entity_id_field, $field_id_field,$delta)
Join field table if necessary.
Parameters
$field_name: Name of the field.
Return value
string
Throws
\Drupal\Core\Entity\Query\QueryException
File
- core/lib/Drupal/Core/Entity/Query/Sql/Tables.php, line 315
Class
- Tables
- Adds tables and fields to the SQL entity query.
Namespace
Drupal\Core\Entity\Query\Sql
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | protected function ensureFieldTable( $index_prefix , & $field , $type , $langcode , $base_table , $entity_id_field , $field_id_field , $delta ) { $field_name = $field ->getName(); if (!isset( $this ->fieldTables[ $index_prefix . $field_name ])) { $entity_type_id = $this ->sqlQuery->getMetaData( 'entity_type' ); /** @var \Drupal\Core\Entity\Sql\DefaultTableMapping $table_mapping */ $table_mapping = $this ->entityManager->getStorage( $entity_type_id )->getTableMapping(); $table = ! $this ->sqlQuery->getMetaData( 'all_revisions' ) ? $table_mapping ->getDedicatedDataTableName( $field ) : $table_mapping ->getDedicatedRevisionTableName( $field ); if ( $field ->getCardinality() != 1) { $this ->sqlQuery->addMetaData( 'simple_query' , FALSE); } $this ->fieldTables[ $index_prefix . $field_name ] = $this ->addJoin( $type , $table , "%alias.$field_id_field = $base_table.$entity_id_field" , $langcode , $delta ); } return $this ->fieldTables[ $index_prefix . $field_name ]; } |
Please login to continue.