You are here

function QueryPluginBase::set_where_group in Views (for Drupal 7) 8.3

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

$group The group ID generated.

4 calls to QueryPluginBase::set_where_group()
Sql::add_having in lib/Drupal/views/Plugin/views/query/Sql.php
Add a simple HAVING clause to the query.
Sql::add_having_expression in lib/Drupal/views/Plugin/views/query/Sql.php
Add a complex HAVING clause to the query. The caller is responsible for ensuring that all fields are fully qualified (TABLE.FIELD) and that the table and an appropriate GROUP BY already exist in the query. Internally the dbtng method…
Sql::add_where in lib/Drupal/views/Plugin/views/query/Sql.php
Add a simple WHERE clause to the query. The caller is responsible for ensuring that all fields are fully qualified (TABLE.FIELD) and that the table already exists in the query.
Sql::add_where_expression in lib/Drupal/views/Plugin/views/query/Sql.php
Add a complex WHERE clause to the query.

File

lib/Drupal/views/Plugin/views/query/QueryPluginBase.php, line 129
Definition of Drupal\views\Plugin\views\query\QueryPluginBase.

Class

QueryPluginBase
@todo.

Namespace

Drupal\views\Plugin\views\query

Code

function set_where_group($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] = array(
      'conditions' => array(),
      'args' => array(),
    );
  }
  $groups[$group]['type'] = strtoupper($type);
  return $group;
}