function SelectInterface::addField

Same name in other branches
  1. 9 core/lib/Drupal/Core/Database/Query/SelectInterface.php \Drupal\Core\Database\Query\SelectInterface::addField()
  2. 8.9.x core/lib/Drupal/Core/Database/Query/SelectInterface.php \Drupal\Core\Database\Query\SelectInterface::addField()
  3. 10 core/lib/Drupal/Core/Database/Query/SelectInterface.php \Drupal\Core\Database\Query\SelectInterface::addField()

Adds a field to the list to be SELECTed.

Parameters

$table_alias: The name of the table from which the field comes, as an alias. Generally you will want to use the return value of join() here to ensure that it is valid.

$field: The name of the field.

$alias: The alias for this field. If not specified, one will be generated automatically based on the $table_alias and $field. The alias will be checked for uniqueness, so the requested alias may not be the alias that is assigned in all cases.

Return value

string The unique alias that was assigned for this field.

2 methods override SelectInterface::addField()
Select::addField in core/lib/Drupal/Core/Database/Query/Select.php
Adds a field to the list to be SELECTed.
SelectExtender::addField in core/lib/Drupal/Core/Database/Query/SelectExtender.php
Adds a field to the list to be SELECTed.

File

core/lib/Drupal/Core/Database/Query/SelectInterface.php, line 197

Class

SelectInterface
Interface definition for a Select Query object.

Namespace

Drupal\Core\Database\Query

Code

public function addField($table_alias, $field, $alias = NULL);

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.