diff --git a/src/Autocomplete/doc/index.rst b/src/Autocomplete/doc/index.rst index 33b635e3e6d..8240b432710 100644 --- a/src/Autocomplete/doc/index.rst +++ b/src/Autocomplete/doc/index.rst @@ -315,8 +315,9 @@ the consequent renders, the default ``query_builder`` will be used:: $builder ->add('food', FoodAutocompleteField::class, [ 'query_builder' => function (EntityRepository $er) { - return $er->createQueryBuilder('o') - ->andWhere($qb->expr()->notIn('o.id', [$currentFoodId])); + $qb = $er->createQueryBuilder('o'); + + return $qb->andWhere($qb->expr()->notIn('o.id', [$currentFoodId])); }; ]) ;