src/Bridge/Doctrine/MongoDbOdm/Filter/RangeFilter.php
protected function addMatch(Builder $aggregationBuilder, string $field, string $matchField, string $operator, string $value)
    {
        switch ($operator) {
            case self::PARAMETER_BETWEEN:
                $rangeValue = explode('..', $value);

                $rangeValue = $this->normalizeBetweenValues($rangeValue);
                if (null === $rangeValue) {
                    return;
                }

                $aggregationBuilder->match()->field($matchField)->gte($rangeValue[0])->lte($rangeValue[1]);

                break;
            case self::PARAMETER_GREATER_THAN:
                $value = $this->normalizeValue($value, $operator);
                if (null === $value) {
                    return;
                }

                $aggregationBuilder->match()->field($matchField)->gt($value);

                break;
            case self::PARAMETER_GREATER_THAN_OR_EQUAL:
                $value = $this->normalizeValue($value, $operator);
                if (null === $value) {
                    return;
                }

                $aggregationBuilder->match()->field($matchField)->gte($value);

                break;
            case self::PARAMETER_LESS_THAN:
                $value = $this->normalizeValue($value, $operator);
                if (null === $value) {
                    return;
                }

                $aggregationBuilder->match()->field($matchField)->lt($value);

                break;
            case self::PARAMETER_LESS_THAN_OR_EQUAL:
                $value = $this->normalizeValue($value, $operator);
                if (null === $value) {
                    return;
                }

                $aggregationBuilder->match()->field($matchField)->lte($value);

                break;
        }
    }
protected function addMatch(Builder $aggregationBuilder, string $field, string $matchField, string $operator, string $value)
    {
        switch ($operator) {
            case self::PARAMETER_BETWEEN:
                $rangeValue = explode('..', $value);

                $rangeValue = $this->normalizeBetweenValues($rangeValue);
                if (null === $rangeValue) {
                    return;
                }

                $aggregationBuilder->match()->field($matchField)->gte($rangeValue[0])->lte($rangeValue[1]);

                break;
            case self::PARAMETER_GREATER_THAN:
                $value = $this->normalizeValue($value, $operator);
                if (null === $value) {
                    return;
                }

                $aggregationBuilder->match()->field($matchField)->gt($value);

                break;
            case self::PARAMETER_GREATER_THAN_OR_EQUAL:
                $value = $this->normalizeValue($value, $operator);
                if (null === $value) {
                    return;
                }

                $aggregationBuilder->match()->field($matchField)->gte($value);

                break;
            case self::PARAMETER_LESS_THAN:
                $value = $this->normalizeValue($value, $operator);
                if (null === $value) {
                    return;
                }

                $aggregationBuilder->match()->field($matchField)->lt($value);

                break;
            case self::PARAMETER_LESS_THAN_OR_EQUAL:
                $value = $this->normalizeValue($value, $operator);
                if (null === $value) {
                    return;
                }

                $aggregationBuilder->match()->field($matchField)->lte($value);

                break;
        }
    }
protected function addMatch ( Builder $ aggregationBuilder , string $ field , string $ matchField , string $ operator , string $ value ) { switch ( $ operator ) { case self :: PARAMETER_BETWEEN : $ rangeValue = explode ( '..' , $ value ) ; $ rangeValue = $ this -> normalizeBetweenValues ( $ rangeValue ) ; if ( null === $ rangeValue ) { return ; } $ aggregationBuilder -> match ( ) -> field ( $ matchField ) -> gte ( $ rangeValue [ 0 ] ) -> lte ( $ rangeValue [ 1 ] ) ; break ; case self :: PARAMETER_GREATER_THAN : $ value = $ this -> normalizeValue ( $ value , $ operator ) ; if ( null === $ value ) { return ; } $ aggregationBuilder -> match ( ) -> field ( $ matchField ) -> gt ( $ value ) ; break ; case self :: PARAMETER_GREATER_THAN_OR_EQUAL : $ value = $ this -> normalizeValue ( $ value , $ operator ) ; if ( null === $ value ) { return ; } $ aggregationBuilder -> match ( ) -> field ( $ matchField ) -> gte ( $ value ) ; break ; case self :: PARAMETER_LESS_THAN : $ value = $ this -> normalizeValue ( $ value , $ operator ) ; if ( null === $ value ) { return ; } $ aggregationBuilder -> match ( ) -> field ( $ matchField ) -> lt ( $ value ) ; break ; case self :: PARAMETER_LESS_THAN_OR_EQUAL : $ value = $ this -> normalizeValue ( $ value , $ operator ) ; if ( null === $ value ) { return ; } $ aggregationBuilder -> match ( ) -> field ( $ matchField ) -> lte ( $ value ) ; break ; } }
Adds the match stage according to the operator.
Adds the match stage according to the operator .