protected function buildMatchingQueryForCriteria($queryBuilder, array $criteria)
    {
        foreach ($criteria as $key => $value) {

            $operator = ' = :%s';

            if (is_array($value)) {

                if (count($value) == 1 && array_keys($value)[0] === '$match') {

                    $firstValue = reset($value);

                    //Only like is supported here at the moment
                    $operator = ' LIKE :%s';
                    $value    = '%' . $firstValue . '%';

                } else {
                    $operator = ' IN (:%s)';
                }
            }

            $queryBuilder->andWhere($this->getAlias() . '.' . $key . sprintf($operator, $key))
                ->setParameter($key, $value);
        }

        return $queryBuilder;
    }
protected function buildMatchingQueryForCriteria($queryBuilder, array $criteria)
    {
        foreach ($criteria as $key => $value) {

            $operator = ' = :%s';

            if (is_array($value)) {

                if (count($value) == 1 && array_keys($value)[0] === '$match') {

                    $firstValue = reset($value);

                    //Only like is supported here at the moment
                    $operator = ' LIKE :%s';
                    $value    = '%' . $firstValue . '%';

                } else {
                    $operator = ' IN (:%s)';
                }
            }

            $queryBuilder->andWhere($this->getAlias() . '.' . $key . sprintf($operator, $key))
                ->setParameter($key, $value);
        }

        return $queryBuilder;
    }
@param \Doctrine\ORM\QueryBuilder $queryBuilder
@param array                      $criteria

@return \Doctrine\ORM\QueryBuilder