sort() public method

If sorting by multiple fields, the first argument should be an array of field name (key) and order (value) pairs.
See also: http://docs.mongodb.org/manual/reference/operator/aggregation/sort/
public sort ( array | string $fieldName, integer | string $order = null ) : Doctrine\MongoDB\Aggregation\Stage\Sort
$fieldName array | string Field name or array of field/order pairs
$order integer | string Field order (if one field is specified)
return Doctrine\MongoDB\Aggregation\Stage\Sort
Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function sort($fieldName, $order = null)
 {
     $fields = is_array($fieldName) ? $fieldName : [$fieldName => $order];
     return parent::sort($this->getDocumentPersister()->prepareSortOrProjection($fields));
 }
Ejemplo n.º 2
0
 /**
  * Sorts all input documents and returns them to the pipeline in sorted order.
  *
  * If sorting by multiple fields, the first argument should be an array of
  * field name (key) and order (value) pairs.
  *
  * @see http://docs.mongodb.org/manual/reference/operator/aggregation/sort/
  *
  * @param array|string $fieldName Field name or array of field/order pairs
  * @param integer|string $order   Field order (if one field is specified)
  * @return Stage\Sort
  */
 public function sort($fieldName, $order = null)
 {
     return $this->builder->sort($fieldName, $order);
 }