/** * {@inheritdoc} */ public function sort($fieldName, $order = null) { $fields = is_array($fieldName) ? $fieldName : [$fieldName => $order]; return parent::sort($this->getDocumentPersister()->prepareSortOrProjection($fields)); }
/** * 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); }