src/Bridge/Doctrine/Orm/Filter/SearchFilter.php
protected function addWhereByStrategy(string $strategy, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $alias, string $field, $value, bool $caseSensitive)
    {
        $wrapCase = $this->createWrapCase($caseSensitive);
        $valueParameter = $queryNameGenerator->generateParameterName($field);

        switch ($strategy) {
            case null:
            case self::STRATEGY_EXACT:
                $queryBuilder
                    ->andWhere(sprintf($wrapCase('%s.%s').' = '.$wrapCase(':%s'), $alias, $field, $valueParameter))
                    ->setParameter($valueParameter, $value);
                break;
            case self::STRATEGY_PARTIAL:
                $queryBuilder
                    ->andWhere(sprintf($wrapCase('%s.%s').' LIKE '.$wrapCase('CONCAT(\'%%\', :%s, \'%%\')'), $alias, $field, $valueParameter))
                    ->setParameter($valueParameter, $value);
                break;
            case self::STRATEGY_START:
                $queryBuilder
                    ->andWhere(sprintf($wrapCase('%s.%s').' LIKE '.$wrapCase('CONCAT(:%s, \'%%\')'), $alias, $field, $valueParameter))
                    ->setParameter($valueParameter, $value);
                break;
            case self::STRATEGY_END:
                $queryBuilder
                    ->andWhere(sprintf($wrapCase('%s.%s').' LIKE '.$wrapCase('CONCAT(\'%%\', :%s)'), $alias, $field, $valueParameter))
                    ->setParameter($valueParameter, $value);
                break;
            case self::STRATEGY_WORD_START:
                $queryBuilder
                    ->andWhere(sprintf($wrapCase('%1$s.%2$s').' LIKE '.$wrapCase('CONCAT(:%3$s, \'%%\')').' OR '.$wrapCase('%1$s.%2$s').' LIKE '.$wrapCase('CONCAT(\'%% \', :%3$s, \'%%\')'), $alias, $field, $valueParameter))
                    ->setParameter($valueParameter, $value);
                break;
            default:
                throw new InvalidArgumentException(sprintf('strategy %s does not exist.', $strategy));
        }
    }
protected function addWhereByStrategy(string $strategy, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $alias, string $field, $value, bool $caseSensitive)
    {
        $wrapCase = $this->createWrapCase($caseSensitive);
        $valueParameter = $queryNameGenerator->generateParameterName($field);

        switch ($strategy) {
            case null:
            case self::STRATEGY_EXACT:
                $queryBuilder
                    ->andWhere(sprintf($wrapCase('%s.%s').' = '.$wrapCase(':%s'), $alias, $field, $valueParameter))
                    ->setParameter($valueParameter, $value);
                break;
            case self::STRATEGY_PARTIAL:
                $queryBuilder
                    ->andWhere(sprintf($wrapCase('%s.%s').' LIKE '.$wrapCase('CONCAT(\'%%\', :%s, \'%%\')'), $alias, $field, $valueParameter))
                    ->setParameter($valueParameter, $value);
                break;
            case self::STRATEGY_START:
                $queryBuilder
                    ->andWhere(sprintf($wrapCase('%s.%s').' LIKE '.$wrapCase('CONCAT(:%s, \'%%\')'), $alias, $field, $valueParameter))
                    ->setParameter($valueParameter, $value);
                break;
            case self::STRATEGY_END:
                $queryBuilder
                    ->andWhere(sprintf($wrapCase('%s.%s').' LIKE '.$wrapCase('CONCAT(\'%%\', :%s)'), $alias, $field, $valueParameter))
                    ->setParameter($valueParameter, $value);
                break;
            case self::STRATEGY_WORD_START:
                $queryBuilder
                    ->andWhere(sprintf($wrapCase('%1$s.%2$s').' LIKE '.$wrapCase('CONCAT(:%3$s, \'%%\')').' OR '.$wrapCase('%1$s.%2$s').' LIKE '.$wrapCase('CONCAT(\'%% \', :%3$s, \'%%\')'), $alias, $field, $valueParameter))
                    ->setParameter($valueParameter, $value);
                break;
            default:
                throw new InvalidArgumentException(sprintf('strategy %s does not exist.', $strategy));
        }
    }
protected function addWhereByStrategy ( string $ strategy , QueryBuilder $ queryBuilder , QueryNameGeneratorInterface $ queryNameGenerator , string $ alias , string $ field , $ value , bool $ caseSensitive ) { $ wrapCase = $ this -> createWrapCase ( $ caseSensitive ) ; $ valueParameter = $ queryNameGenerator -> generateParameterName ( $ field ) ; switch ( $ strategy ) { case null : case self :: STRATEGY_EXACT : $ queryBuilder -> andWhere ( sprintf ( $ wrapCase ( '%s.%s' ) . ' = ' . $ wrapCase ( ':%s' ) , $ alias , $ field , $ valueParameter ) ) -> setParameter ( $ valueParameter , $ value ) ; break ; case self :: STRATEGY_PARTIAL : $ queryBuilder -> andWhere ( sprintf ( $ wrapCase ( '%s.%s' ) . ' LIKE ' . $ wrapCase ( 'CONCAT(\'%%\', :%s, \'%%\')' ) , $ alias , $ field , $ valueParameter ) ) -> setParameter ( $ valueParameter , $ value ) ; break ; case self :: STRATEGY_START : $ queryBuilder -> andWhere ( sprintf ( $ wrapCase ( '%s.%s' ) . ' LIKE ' . $ wrapCase ( 'CONCAT(:%s, \'%%\')' ) , $ alias , $ field , $ valueParameter ) ) -> setParameter ( $ valueParameter , $ value ) ; break ; case self :: STRATEGY_END : $ queryBuilder -> andWhere ( sprintf ( $ wrapCase ( '%s.%s' ) . ' LIKE ' . $ wrapCase ( 'CONCAT(\'%%\', :%s)' ) , $ alias , $ field , $ valueParameter ) ) -> setParameter ( $ valueParameter , $ value ) ; break ; case self :: STRATEGY_WORD_START : $ queryBuilder -> andWhere ( sprintf ( $ wrapCase ( '%1$s.%2$s' ) . ' LIKE ' . $ wrapCase ( 'CONCAT(:%3$s, \'%%\')' ) . ' OR ' . $ wrapCase ( '%1$s.%2$s' ) . ' LIKE ' . $ wrapCase ( 'CONCAT(\'%% \', :%3$s, \'%%\')' ) , $ alias , $ field , $ valueParameter ) ) -> setParameter ( $ valueParameter , $ value ) ; break ; default : throw new InvalidArgumentException ( sprintf ( 'strategy %s does not exist.' , $ strategy ) ) ; } }
Adds where clause according to the strategy.

@throws InvalidArgumentException If strategy does not exist
Adds where clause according to the strategy .