W3cubDocs

/Drupal 8

public function SelectExtender::havingCondition

public SelectExtender::havingCondition($field, $value = NULL, $operator = '=')

Helper function to build most common HAVING conditional clauses.

This method can take a variable number of parameters. If called with two parameters, they are taken as $field and $value with $operator having a value of IN if $value is an array and = otherwise.

Parameters

$field: The name of the field to check. If you would like to add a more complex condition involving operators or functions, use having().

$value: The value to test the field against. In most cases, this is a scalar. For more complex options, it is an array. The meaning of each element in the array is dependent on the $operator.

$operator: The comparison operator, such as =, <, or >=. It also accepts more complex options such as IN, LIKE, or BETWEEN. Defaults to IN if $value is an array = otherwise.

Return value

\Drupal\Core\Database\Query\ConditionInterface The called object.

Overrides SelectInterface::havingCondition

File

core/lib/Drupal/Core/Database/Query/SelectExtender.php, line 147

Class

SelectExtender
The base extender class for Select queries.

Namespace

Drupal\Core\Database\Query

Code

public function havingCondition($field, $value = NULL, $operator = '=') {
  $this->query->havingCondition($field, $value, $operator);
  return $this;
}

© 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!Database!Query!SelectExtender.php/function/SelectExtender::havingCondition/8.1.x