function SelectInterface::havingCondition
Same name in other branches
- 9 core/lib/Drupal/Core/Database/Query/SelectInterface.php \Drupal\Core\Database\Query\SelectInterface::havingCondition()
- 10 core/lib/Drupal/Core/Database/Query/SelectInterface.php \Drupal\Core\Database\Query\SelectInterface::havingCondition()
- 11.x core/lib/Drupal/Core/Database/Query/SelectInterface.php \Drupal\Core\Database\Query\SelectInterface::havingCondition()
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.
2 methods override SelectInterface::havingCondition()
- Select::havingCondition in core/
lib/ Drupal/ Core/ Database/ Query/ Select.php - Helper function to build most common HAVING conditional clauses.
- SelectExtender::havingCondition in core/
lib/ Drupal/ Core/ Database/ Query/ SelectExtender.php - Helper function to build most common HAVING conditional clauses.
File
-
core/
lib/ Drupal/ Core/ Database/ Query/ SelectInterface.php, line 559
Class
- SelectInterface
- Interface definition for a Select Query object.
Namespace
Drupal\Core\Database\QueryCode
public function havingCondition($field, $value = NULL, $operator = NULL);
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.