/** * @param Builder $builder * @param array|string $fieldName Field name or array of field/order pairs * @param int|string $order Field order (if one field is specified) */ public function __construct(Builder $builder, $fieldName, $order = null) { parent::__construct($builder); $allowedMetaSort = array('textScore'); $fields = is_array($fieldName) ? $fieldName : array($fieldName => $order); foreach ($fields as $fieldName => $order) { if (is_string($order)) { if (in_array($order, $allowedMetaSort)) { $order = array('$meta' => $order); } else { $order = strtolower($order) === 'asc' ? 1 : -1; } } $this->sort[$fieldName] = $order; } }
/** * {@inheritdoc} */ public function __construct(Builder $builder) { $this->expr = new Expr(); parent::__construct($builder); }
/** * @param Builder $builder * @param integer $skip */ public function __construct(Builder $builder, $skip) { parent::__construct($builder); $this->skip = (int) $skip; }
/** * @param Builder $builder * @param string $fieldName */ public function __construct(Builder $builder, $fieldName) { parent::__construct($builder); $this->fieldName = (string) $fieldName; }
/** * @param Builder $builder * @param integer $limit */ public function __construct(Builder $builder, $limit) { parent::__construct($builder); $this->limit = (int) $limit; }
/** * @param Builder $builder * @param string $collection */ public function __construct(Builder $builder, $collection) { parent::__construct($builder); $this->collection = $collection; }
/** * {@inheritdoc} */ public function __construct(Builder $builder) { parent::__construct($builder); $this->query = new Expr(); }