src/Bridge/Doctrine/ORM/Event/Subscriber/ORMSubscriber.php
public function addFilters(ORMFilterEvent $event)
    {
        $queryBuilder = $event->getQueryBuilder();

        foreach ($event->getFilters() as $filter) {
            $alias = $queryBuilder->getRootAliases()[0];
            $parameterName = 'filter_'.$filter->getName();
            $value = $filter->getValue();

            if ('like' === $filter->getComparator()) {
                $value = '%'.$value.'%';
            }

            if ('and' === $filter->getOperator()) {
                $method = 'andWhere';
            } else {
                $method = 'orWhere';
            }

            $queryBuilder->$method(sprintf(
                '%s.%s %s %s',
                $alias,
                $filter->getName(),
                $filter->getComparator(),
                ':'.$parameterName
            ));
            $queryBuilder->setParameter($parameterName, $value);
        }
    }
public function addFilters(ORMFilterEvent $event)
    {
        $queryBuilder = $event->getQueryBuilder();

        foreach ($event->getFilters() as $filter) {
            $alias = $queryBuilder->getRootAliases()[0];
            $parameterName = 'filter_'.$filter->getName();
            $value = $filter->getValue();

            if ('like' === $filter->getComparator()) {
                $value = '%'.$value.'%';
            }

            if ('and' === $filter->getOperator()) {
                $method = 'andWhere';
            } else {
                $method = 'orWhere';
            }

            $queryBuilder->$method(sprintf(
                '%s.%s %s %s',
                $alias,
                $filter->getName(),
                $filter->getComparator(),
                ':'.$parameterName
            ));
            $queryBuilder->setParameter($parameterName, $value);
        }
    }
public function addFilters ( ORMFilterEvent $ event ) { $ queryBuilder = $ event -> getQueryBuilder ( ) ; foreach ( $ event -> getFilters ( ) as $ filter ) { $ alias = $ queryBuilder -> getRootAliases ( ) [ 0 ] ; $ parameterName = 'filter_' . $ filter -> getName ( ) ; $ value = $ filter -> getValue ( ) ; if ( 'like' === $ filter -> getComparator ( ) ) { $ value = '%' . $ value . '%' ; } if ( 'and' === $ filter -> getOperator ( ) ) { $ method = 'andWhere' ; } else { $ method = 'orWhere' ; } $ queryBuilder -> $ method ( sprintf ( '%s.%s %s %s' , $ alias , $ filter -> getName ( ) , $ filter -> getComparator ( ) , ':' . $ parameterName ) ) ; $ queryBuilder -> setParameter ( $ parameterName , $ value ) ; } }
Add filter to the query builder.

@param ORMFilterEvent $event
Add filter to the query builder .