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

public where ( $where = '', $whereValues = null )
Пример #1
0
 /**
  * @test
  */
 public function shouldSkipEmptyWheres()
 {
     // given
     $query = new Query();
     $query->table = 'products';
     $query->where();
     $query->where('id = ?', 1);
     // when
     $sql = $this->_dialect->buildQuery($query);
     // then
     $this->assertEquals('SELECT * FROM products WHERE id = ?', $sql);
 }
Пример #2
0
 /**
  * @param string $where
  * @param array $values
  * @return ModelQueryBuilder
  */
 public function where($where = '', $values = array())
 {
     $this->_query->where($where, $values);
     return $this;
 }
Пример #3
0
 /**
  * @test
  */
 public function shouldBuildUpdateQuery()
 {
     //given
     $query = new Query();
     $query->table = 'products';
     $query->type = QueryType::$UPDATE;
     $query->updateAttributes = array('col1' => 'val1', 'col2' => 'val2');
     $query->where(array('col1' => 'prev1', 'col2' => 'prev2'));
     //when
     $sql = $this->dialect->buildQuery($query);
     //then
     $this->assertEquals("UPDATE products SET col1 = ?, col2 = ? WHERE col1 = ? AND col2 = ?", $sql);
 }