private function getOperators(string $fieldName, LeafType $leafType, bool $isAssociation, bool $isCollection): array
    {
        $scalarOperators = [
            BetweenOperatorType::class,
            EqualOperatorType::class,
            GreaterOperatorType::class,
            GreaterOrEqualOperatorType::class,
            InOperatorType::class,
            LessOperatorType::class,
            LessOrEqualOperatorType::class,
            LikeOperatorType::class,
            NullOperatorType::class,
            GroupOperatorType::class,
        ];

        $associationOperators = [
            HaveOperatorType::class,
            EmptyOperatorType::class,
        ];

        $operatorKeys = [];
        if ($isAssociation) {
            $operatorKeys = array_merge($operatorKeys, $associationOperators);
        }

        if (!$isCollection) {
            $operatorKeys = array_merge($operatorKeys, $scalarOperators);
        }

        $operators = array_fill_keys($operatorKeys, $leafType);

        // Add custom filters if any
        if (isset($this->customOperators[$fieldName])) {
            foreach ($this->customOperators[$fieldName] as $filter) {
                /** @var LeafType $leafType */
                $leafType = $this->types->get($filter->type);
                $operators[$filter->operator] = $leafType;
            }

            unset($this->customOperators[$fieldName]);
        }

        return $operators;
    }
private function getOperators(string $fieldName, LeafType $leafType, bool $isAssociation, bool $isCollection): array
    {
        $scalarOperators = [
            BetweenOperatorType::class,
            EqualOperatorType::class,
            GreaterOperatorType::class,
            GreaterOrEqualOperatorType::class,
            InOperatorType::class,
            LessOperatorType::class,
            LessOrEqualOperatorType::class,
            LikeOperatorType::class,
            NullOperatorType::class,
            GroupOperatorType::class,
        ];

        $associationOperators = [
            HaveOperatorType::class,
            EmptyOperatorType::class,
        ];

        $operatorKeys = [];
        if ($isAssociation) {
            $operatorKeys = array_merge($operatorKeys, $associationOperators);
        }

        if (!$isCollection) {
            $operatorKeys = array_merge($operatorKeys, $scalarOperators);
        }

        $operators = array_fill_keys($operatorKeys, $leafType);

        // Add custom filters if any
        if (isset($this->customOperators[$fieldName])) {
            foreach ($this->customOperators[$fieldName] as $filter) {
                /** @var LeafType $leafType */
                $leafType = $this->types->get($filter->type);
                $operators[$filter->operator] = $leafType;
            }

            unset($this->customOperators[$fieldName]);
        }

        return $operators;
    }
private function getOperators ( string $ fieldName , LeafType $ leafType , bool $ isAssociation , bool $ isCollection ) : array { $ scalarOperators = [ BetweenOperatorType :: class , EqualOperatorType :: class , GreaterOperatorType :: class , GreaterOrEqualOperatorType :: class , InOperatorType :: class , LessOperatorType :: class , LessOrEqualOperatorType :: class , LikeOperatorType :: class , NullOperatorType :: class , GroupOperatorType :: class , ] ; $ associationOperators = [ HaveOperatorType :: class , EmptyOperatorType :: class , ] ; $ operatorKeys = [ ] ; if ( $ isAssociation ) { $ operatorKeys = array_merge ( $ operatorKeys , $ associationOperators ) ; } if ( ! $ isCollection ) { $ operatorKeys = array_merge ( $ operatorKeys , $ scalarOperators ) ; } $ operators = array_fill_keys ( $ operatorKeys , $ leafType ) ; // Add custom filters if any if ( isset ( $ this -> customOperators [ $ fieldName ] ) ) { foreach ( $ this -> customOperators [ $ fieldName ] as $ filter ) { /** @var LeafType $leafType */ $ leafType = $ this -> types -> get ( $ filter -> type ) ; $ operators [ $ filter -> operator ] = $ leafType ; } unset ( $ this -> customOperators [ $ fieldName ] ) ; } return $ operators ; }
Return a map of operator class name and their leaf type, including custom operator for the given fieldName

@param string $fieldName
@param LeafType $leafType
@param bool $isAssociation
@param bool $isCollection

@return LeafType[] indexed by operator class name
Return a map of operator class name and their leaf type including custom operator for the given fieldName