andHaving() public method

The new condition and the existing one will be joined using the 'AND' operator.
See also: having()
See also: orHaving()
public andHaving ( string | array | yii\db\Expression $condition, array $params = [] )
$condition string | array | yii\db\Expression the new HAVING condition. Please refer to [[where()]] on how to specify this parameter.
$params array the parameters (name => value) to be bound to the query.
 public function testHaving()
 {
     $query = new Query();
     $query->having('id = :id', [':id' => 1]);
     $this->assertEquals('id = :id', $query->having);
     $this->assertEquals([':id' => 1], $query->params);
     $query->andHaving('name = :name', [':name' => 'something']);
     $this->assertEquals(['and', 'id = :id', 'name = :name'], $query->having);
     $this->assertEquals([':id' => 1, ':name' => 'something'], $query->params);
     $query->orHaving('age = :age', [':age' => '30']);
     $this->assertEquals(['or', ['and', 'id = :id', 'name = :name'], 'age = :age'], $query->having);
     $this->assertEquals([':id' => 1, ':name' => 'something', ':age' => '30'], $query->params);
 }