Exemplo n.º 1
0
 protected function prepareCursor(Cursor $cursor)
 {
     $cursor->limit($this->query['limit']);
     $cursor->skip($this->query['skip']);
     $cursor->sort($this->query['sort']);
     $cursor->immortal($this->query['immortal']);
     if (null !== $this->query['slaveOkay']) {
         $cursor->slaveOkay($this->query['slaveOkay']);
     }
     if ($this->query['snapshot']) {
         $cursor->snapshot();
     }
     foreach ($this->query['hints'] as $keyPattern) {
         $cursor->hint($keyPattern);
     }
     if ($this->query['eagerCursor'] === true) {
         $cursor = new EagerCursor($cursor);
     }
     return $cursor;
 }
Exemplo n.º 2
0
 protected function prepareCursor(Cursor $cursor)
 {
     $cursor->limit($this->query['limit']);
     $cursor->skip($this->query['skip']);
     $cursor->sort($this->query['sort']);
     $cursor->immortal($this->query['immortal']);
     $cursor->slaveOkay($this->query['slaveOkay']);
     if ($this->query['snapshot']) {
         $cursor->snapshot();
     }
     foreach ($this->query['hints'] as $keyPattern) {
         $cursor->hint($keyPattern);
     }
 }
Exemplo n.º 3
0
 /**
  * Wrapper method for MongoCursor::sort().
  *
  * Field names will be prepared according to the document mapping.
  *
  * @see \Doctrine\MongoDB\Cursor::sort()
  * @see http://php.net/manual/en/mongocursor.sort.php
  * @param array $fields
  * @return self
  */
 public function sort($fields)
 {
     $fields = $this->unitOfWork->getDocumentPersister($this->class->name)->prepareSortOrProjection($fields);
     $this->baseCursor->sort($fields);
     return $this;
 }
Exemplo n.º 4
0
 /** @override */
 public function sort($fields)
 {
     $fields = $this->unitOfWork->getDocumentPersister($this->class->name)->prepareSort($fields);
     $fields = parent::sort($fields);
     return $this;
 }