yii\db\QueryInterface::andWhere PHP Method

andWhere() public method

The new condition and the existing one will be joined using the 'AND' operator.
See also: where()
See also: orWhere()
public andWhere ( string | array $condition )
$condition string | array the new WHERE condition. Please refer to [[where()]] on how to specify this parameter.
    public function andWhere($condition);

Usage Example

 /**
  * Set the page-from-pk option
  * @param QueryInterface $query
  */
 protected function setPageFrom(QueryInterface $query)
 {
     if ($this->pageFromPk) {
         $class = $this->query->modelClass;
         $pks = $class::primaryKey();
         if (count($pks) > 1) {
             throw new NotSupportedException('The "page-from-pk" filter can not be apply for composite primary key.');
         }
         $query->andWhere(['<', $pks[0], $this->pageFromPk]);
     }
     return $query;
 }
All Usage Examples Of yii\db\QueryInterface::andWhere