Repository/DynamicRepository.php
protected function addFilter($queryBuilder, $filters)
    {
        $fromDate = null;
        $toDate = null;
        $search = null;
        $searchFields = null;

        if (isset($filters['fromDate'])) {
            $fromDate = $filters['fromDate'];
            unset($filters['fromDate']);
        }

        if (isset($filters['toDate'])) {
            $toDate = $filters['toDate'];
            unset($filters['toDate']);
        }

        if (isset($filters['search'])) {
            $search = $filters['search'];
            unset($filters['search']);
        }

        if (isset($filters['searchFields'])) {
            $searchFields = $filters['searchFields'];
            unset($filters['searchFields']);
        }

        $this->addSearchFilter($queryBuilder, $search, $searchFields);
        $this->addDateRangeFilter($queryBuilder, $fromDate, $toDate);

        $counter = 0;
        foreach ($filters as $key => $value) {
            $queryBuilder->andWhere($queryBuilder->expr()->eq('dynamic.' . $key, ':value' . $counter));
            $queryBuilder->setParameter('value' . $counter, $value);

            ++$counter;
        }
    }
protected function addFilter($queryBuilder, $filters)
    {
        $fromDate = null;
        $toDate = null;
        $search = null;
        $searchFields = null;

        if (isset($filters['fromDate'])) {
            $fromDate = $filters['fromDate'];
            unset($filters['fromDate']);
        }

        if (isset($filters['toDate'])) {
            $toDate = $filters['toDate'];
            unset($filters['toDate']);
        }

        if (isset($filters['search'])) {
            $search = $filters['search'];
            unset($filters['search']);
        }

        if (isset($filters['searchFields'])) {
            $searchFields = $filters['searchFields'];
            unset($filters['searchFields']);
        }

        $this->addSearchFilter($queryBuilder, $search, $searchFields);
        $this->addDateRangeFilter($queryBuilder, $fromDate, $toDate);

        $counter = 0;
        foreach ($filters as $key => $value) {
            $queryBuilder->andWhere($queryBuilder->expr()->eq('dynamic.' . $key, ':value' . $counter));
            $queryBuilder->setParameter('value' . $counter, $value);

            ++$counter;
        }
    }
Adds the filters from the given array to the QueryBuilder.

@param QueryBuilder $queryBuilder
@param array $filters