Pop\Db\Sql\Predicate::in PHP Метод

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

Predicate for IN
public in ( string $column, mixed $values, string $combine = 'AND' ) : Predicate
$column string
$values mixed
$combine string
Результат Predicate
    public function in($column, $values, $combine = 'AND')
    {
        $this->predicates[] = array('format' => '%1 IN (%2)', 'values' => array($column, $values), 'combine' => $combine == 'OR' ? 'OR' : 'AND');
        return $this;
    }

Usage Example

Пример #1
0
 public function testIn()
 {
     $p = new Predicate(Sql::factory(Db::factory('Sqlite', array('database' => __DIR__ . '/../tmp/test.sqlite')), 'users'));
     $p->in('id', array(1, 2, 3));
     $this->assertEquals('("id" IN (1, 2, 3))', (string) $p);
 }