Adds a restriction over the groups of the query, forming a logical
disjunction with any existing having restrictions.

@param mixed $having The restriction to add.

@return $this This QueryBuilder instance.
423197
public function orHaving($having)
    {
        $args   = func_get_args();
        $having = $this->getQueryPart('having');

        if ($having instanceof CompositeExpression && $having->getType() === CompositeExpression::TYPE_OR) {
            $having->addMultiple($args);
        } else {
            array_unshift($args, $having);
            $having = new CompositeExpression(CompositeExpression::TYPE_OR, $args);
        }

        return $this->add('having', $having);
    }
592891
public function having() {
        $args = func_get_args();
        $this->build()->bindExpression('having', $args[0] . $args[1] . ' ? ');
        $this->build()->bindParams('having', $args[2]);

        return $this->connection;
    }
433711
public function having($having)
    {
        if (false == ($having instanceof Q)) {
            $having = new QAnd($having);
        }
        $having->setLookupBuilder($this->getLookupBuilder());
        $having->setAdapter($this->getAdapter());

        $this->sqlParts['having'] = $having;

        return $this;
    }
1189254
protected function compileHaving(array $having)
    {
        // If the having clause is "raw", we can just return the clause straight away
        // without doing any more processing on it. Otherwise, we will compile the
        // clause into SQL based on the components that make it up from builder.
        if ($having['type'] === 'Raw') {
            return $having['boolean'].' '.$having['sql'];
        } elseif ($having['type'] === 'between') {
            return $this->compileHavingBetween($having);
        }

        return $this->compileBasicHaving($having);
    }
82819
public SqlBuilder having(final String what) {
    Assert.isTrue(null != groups && !groups.isEmpty());
    if (Strings.isNotEmpty(what)) having = what;
    return this;
  }
313159
public function havingRaw(string $condition): self
    {
        $this->condition->having([new RawExp($condition)]);

        return $this;
    }
410591
public function having(string $sql, array $params = []) : self
    {
        $this->qiterator = null;
        $this->having[] = [ $sql, $params ];
        return $this;
    }
766365
public function having($sql=null, $params=array())
    {
        $this->_having = new Criteria($sql, $params);

        return $this;
    }
728279
protected function buildHaving()
    {
        if (count($this->having) === 0) {
            return '';
        }

        // Use a ConditionSet to build the having clause
        $conditionSet = new Query\Condition\AndSet($this, $this->having);
        return "HAVING {$conditionSet->buildWithoutParentheses()}";
    }
789283
public function buildHaving()
	{
		$havings = [];

		foreach ($this->having as $having)
		{
			$havings[] = $having['column'] . ' ' . $having['operator'] . ' ?';

			$this->bind(is_string($having['value']) ? trim($having['value']) : $having['value']);
		}

		return 'HAVING ' . implode(" AND ", $havings);
	}
784576
public function filterByGroup($group = '', $inGroup = true)
    {
        if (!($group instanceof \Concrete\Core\User\Group\Group)) {
            $group = \Concrete\Core\User\Group\Group::getByName($group);
        }
        $this->checkGroupJoin();
        $app = Application::getFacadeApplication();
        /** @var $likeBuilder LikeBuilder */
        $likeBuilder = $app->make(LikeBuilder::class);
        $query = $this->getQueryObject()->getConnection()->createQueryBuilder();
        $orX = $this->getQueryObject()->expr()->orX();
        $query->select('u.uID')->from('Users','u')
            ->leftJoin('u','UserGroups','ug','u.uID=ug.uID')
            ->leftJoin('ug', $query->getConnection()->getDatabasePlatform()->quoteSingleIdentifier('Groups'), 'g', 'ug.gID=g.gID');
        $orX->add($this->getQueryObject()->expr()->like('g.gPath', ':groupPath_'.$group->getGroupID()));
        $this->getQueryObject()->setParameter('groupPath_'.$group->getGroupID(),$likeBuilder->escapeForLike($group->getGroupPath()). '/%');
        $orX->add($this->getQueryObject()->expr()->eq('g.gID', $group->getGroupID()));
        $query->where($orX);
        if ($inGroup) {
            $this->getQueryObject()->andWhere($this->getQueryObject()->expr()->in('u.uID', $query->getSQL()));
        } else {
            $this->getQueryObject()->andWhere($this->getQueryObject()->expr()->notIn('u.uID', $query->getSQL()));
        }

    }
1295399
public function addSet($_)
    {
        RecursiveArgs::each(func_get_args(), function ($arg) {
            $this->setClauses[] = $arg;
        });

        return $this;
    }
989415
public function addCondition($condition)
    {
        if (!$this->conditions->contains($condition)) {
            $this->conditions[] = $condition;
        }

        return $this;
    }
1069694
public function having($conditions, ...$parameters)
    {
        if (is_array($conditions)) {
            $this->having = array_merge($this->where, array_map(function ($value, $field) {
                return $field . '=' . $this->connection->quote($value);
            }, $conditions, array_keys($conditions)));
        } else {
            if ($parameters) {
                $conditions = $this->connection->merge($conditions, $parameters);
            }
            $this->having[] = $conditions;
        }

        return $this;
    }
815788
public function having($condition, $value = null, $logic = 'AND')
    {
        return $this->_append('Having', array($condition, $value), $logic);
    }
1068654
public function groupBy()
    {
        $args = func_get_args();
        while ($arg = array_shift($args)) {
            $this->group->add($arg);
        }
        return $this;
    }
383909
public OqlBuilder<T> having(final String what) {
    Assert.isTrue(null != groups && !groups.isEmpty());
    if (Strings.isNotEmpty(what)) having = what;
    return this;
  }