Builds an executes a query whichs searches and sorts documents from a repository.
Exemple #1
0
 public function testAddingSubPredicate()
 {
     $pred = new Predicate();
     $pred->where('name', '==', 'hannah')->andWhere(function ($query) {
         $query->where('age', '<', 20)->orWhere('age', '>', 30);
     });
     $this->assertEquals(array(array(false, 'name', '==', 'hannah'), array('and', array(array(false, 'age', '<', 20), array('or', 'age', '>', 30)))), $pred->getAll());
 }
Exemple #2
0
 public function testPredicate()
 {
     $path = __DIR__ . '/fixtures/datastore/querytest';
     $config = new Config($path . '/');
     $repo = new Repository('countries', $config);
     $query = new Query($repo);
     $query->where('cca2', '==', 'GB');
     $predicate = new Predicate();
     $predicate->where('cca2', '==', 'GB');
     $this->assertAttributeEquals($predicate, 'predicate', $query);
 }