예제 #1
0
 public function testFullFluency()
 {
     $expected = array('bob' => 'hoskins', 'abc' => 12);
     $query = new Morph_Query();
     $query->limit(10)->skip(12)->property('bob')->equals('hoskins')->property('abc')->equals(12);
     $this->assertEquals($expected, $query->getRawQuery());
     $this->assertEquals(10, $query->getLimit());
     $this->assertEquals(12, $query->getSkip());
 }
예제 #2
0
<?php

//Create and instance of Morph_Storage passing in the appropriate database
$mongo = new Mongo();
$storage = new Morph_Storage($mongo->selectDb('myDB'));
//Find a maximum of 10 users that has more than 15 posts, skipping the first 10
$query = new Morph_Query();
$query->limit(10)->skip(10)->property('numberOfPosts')->greaterThan(15);
$users = $storage->findByQuery(new User(), $query);
예제 #3
0
 /**
  * Sets the limit for the result set
  *
  * @param int $limit
  * @return Morph_Query
  */
 public function limit($limit)
 {
     return $this->query->limit($limit);
 }
예제 #4
0
<?php
//Initialise Morph_Storage passing in the appropriate database
$mongo = new Mongo();
Morph_Storage::init($mongo->selectDb('myDB'));

//Find a maximum of 10 users that has more than 15 posts, skipping the first 10
$user = new User();
$query = new Morph_Query();
$query->limit(10)
      ->skip(10)
      ->property('numberOfPosts')
      ->greaterThan(15);
$users = $user->findByQuery($query);