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

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

Determine if it has a nested predicate branch
public hasNest ( integer $i = null ) : boolean
$i integer
Результат boolean
    public function hasNest($i = null)
    {
        return null === $i ? count($this->nested) > 0 : isset($this->nested[$i]);
    }

Usage Example

Пример #1
0
 public function testNest()
 {
     $p = new Predicate(Sql::factory(Db::factory('Sqlite', array('database' => __DIR__ . '/../tmp/test.sqlite')), 'users'));
     $p->nest()->equalTo('id', 5, 'OR')->equalTo('id', 6, 'OR');
     $p->equalTo('access', 'reader');
     $this->assertTrue($p->hasNest());
     $this->assertInstanceOf('Pop\\Db\\Sql\\Predicate', $p->getNest(0));
     $this->assertEquals('(("id" = 5) OR ("id" = 6)) AND ("access" = \'reader\')', (string) $p);
 }