Nette\Database\Table\SqlBuilder::addWhere PHP Метод

addWhere() публичный Метод

public addWhere ( $condition, $params )
    public function addWhere($condition, ...$params)
    {
        return $this->addCondition($condition, $params, $this->where, $this->parameters['where']);
    }

Usage Example

Пример #1
0
 /**
  * Adds where condition, more calls appends with AND.
  * @param  string condition possibly containing ?
  * @param  mixed
  * @param  mixed ...
  * @return self
  */
 public function where($condition, ...$params)
 {
     $this->emptyResultSet();
     if (is_array($condition) && $params === []) {
         // where(array('column1' => 1, 'column2 > ?' => 2))
         foreach ($condition as $key => $val) {
             if (is_int($key)) {
                 $this->sqlBuilder->addWhere($val);
                 // where('full condition')
             } else {
                 $this->sqlBuilder->addWhere($key, $val);
                 // where('column', 1)
             }
         }
     } else {
         $this->sqlBuilder->addWhere($condition, ...$params);
     }
     return $this;
 }
All Usage Examples Of Nette\Database\Table\SqlBuilder::addWhere