/** * @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 = ['textScore']; $fields = is_array($fieldName) ? $fieldName : [$fieldName => $order]; foreach ($fields as $fieldName => $order) { if (is_string($order)) { if (in_array($order, $allowedMetaSort)) { $order = ['$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 string $collection */ public function __construct(Builder $builder, $collection) { parent::__construct($builder); $this->collection = $collection; }
/** * @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; }
/** * {@inheritdoc} */ public function __construct(Builder $builder) { parent::__construct($builder); $this->query = $this->expr(); }
/** * Lookup constructor. * * @param Builder $builder * @param string $from */ public function __construct(Builder $builder, $from) { parent::__construct($builder); $this->from($from); }
/** * @param Builder $builder * @param integer $skip */ public function __construct(Builder $builder, $skip) { parent::__construct($builder); $this->skip = (int) $skip; }
/** * @param Builder $builder * @param integer $size */ public function __construct(Builder $builder, $size) { parent::__construct($builder); $this->size = (int) $size; }