Doctrine\MongoDB\Aggregation\Stage::__construct PHP Method

__construct() public method

public __construct ( Builder $builder )
$builder Builder
    public function __construct(Builder $builder)
    {
        $this->builder = $builder;
    }

Usage Example

Beispiel #1
0
 /**
  * @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;
     }
 }
All Usage Examples Of Doctrine\MongoDB\Aggregation\Stage::__construct