function QueryPluginBase::setWhereGroup
Same name in other branches
- 8.9.x core/modules/views/src/Plugin/views/query/QueryPluginBase.php \Drupal\views\Plugin\views\query\QueryPluginBase::setWhereGroup()
- 10 core/modules/views/src/Plugin/views/query/QueryPluginBase.php \Drupal\views\Plugin\views\query\QueryPluginBase::setWhereGroup()
- 11.x core/modules/views/src/Plugin/views/query/QueryPluginBase.php \Drupal\views\Plugin\views\query\QueryPluginBase::setWhereGroup()
Create a new grouping for the WHERE or HAVING clause.
Parameters
$type: Either 'AND' or 'OR'. All items within this group will be added to the WHERE clause with this logical operator.
$group: An ID to use for this group. If unspecified, an ID will be generated.
$where: 'where' or 'having'.
Return value
int|string The group ID generated.
3 calls to QueryPluginBase::setWhereGroup()
- Sql::addHavingExpression in core/
modules/ views/ src/ Plugin/ views/ query/ Sql.php - Add a complex HAVING clause to the query.
- Sql::addWhere in core/
modules/ views/ src/ Plugin/ views/ query/ Sql.php - Adds a simple WHERE clause to the query.
- Sql::addWhereExpression in core/
modules/ views/ src/ Plugin/ views/ query/ Sql.php - Adds a complex WHERE clause to the query.
File
-
core/
modules/ views/ src/ Plugin/ views/ query/ QueryPluginBase.php, line 171
Class
- QueryPluginBase
- Base plugin class for Views queries.
Namespace
Drupal\views\Plugin\views\queryCode
public function setWhereGroup($type = 'AND', $group = NULL, $where = 'where') {
// Set an alias.
$groups =& $this->{$where};
if (!isset($group)) {
$group = empty($groups) ? 1 : max(array_keys($groups)) + 1;
}
// Create an empty group
if (empty($groups[$group])) {
$groups[$group] = [
'conditions' => [],
'args' => [],
];
}
$groups[$group]['type'] = strtoupper($type);
return $group;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.