protected function fixDoctrineQueryBuilderNormalizer(OptionsResolver $resolver)
    {
        $queryBuilderNormalizer = function (Options $options, $queryBuilder) {
            if (\is_callable($queryBuilder)) {
                $queryBuilder = $queryBuilder($this->entityManager->getRepository($options['class']), $options);

                if (!$queryBuilder instanceof QueryBuilder) {
                    throw new UnexpectedTypeException($queryBuilder, QueryBuilder::class);
                }
            }

            return $queryBuilder;
        };

        $resolver->setNormalizer('query_builder', $queryBuilderNormalizer);
    }
protected function fixDoctrineQueryBuilderNormalizer(OptionsResolver $resolver)
    {
        $queryBuilderNormalizer = function (Options $options, $queryBuilder) {
            if (\is_callable($queryBuilder)) {
                $queryBuilder = $queryBuilder($this->entityManager->getRepository($options['class']), $options);

                if (!$queryBuilder instanceof QueryBuilder) {
                    throw new UnexpectedTypeException($queryBuilder, QueryBuilder::class);
                }
            }

            return $queryBuilder;
        };

        $resolver->setNormalizer('query_builder', $queryBuilderNormalizer);
    }
protected function fixDoctrineQueryBuilderNormalizer ( OptionsResolver $ resolver ) { $ queryBuilderNormalizer = function ( Options $ options , $ queryBuilder ) { if ( \ is_callable ( $ queryBuilder ) ) { $ queryBuilder = $ queryBuilder ( $ this -> entityManager -> getRepository ( $ options [ 'class' ] ) , $ options ) ; if ( ! $ queryBuilder instanceof QueryBuilder ) { throw new UnexpectedTypeException ( $ queryBuilder , QueryBuilder :: class ) ; } } return $ queryBuilder ; } ; $ resolver -> setNormalizer ( 'query_builder' , $ queryBuilderNormalizer ) ; }
Adding an options parameter in the query builder normalizer
Taken directly from \Symfony\Bridge\Doctrine\Form\Type\EntityType

@param OptionsResolver $resolver

@throws \Exception
Adding an options parameter in the query builder normalizer Taken directly from \ Symfony \ Bridge \ Doctrine \ Form \ Type \ EntityType