From 27e539bb187a52766f05c2fb57426aa4fad93b3a Mon Sep 17 00:00:00 2001 From: Tac Tacelosky Date: Sun, 29 Dec 2024 18:16:09 -0500 Subject: [PATCH 1/2] replace undefined $qb replace with creating it from the entity repository --- src/Autocomplete/doc/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Autocomplete/doc/index.rst b/src/Autocomplete/doc/index.rst index 33b635e3e6d..08b51e86308 100644 --- a/src/Autocomplete/doc/index.rst +++ b/src/Autocomplete/doc/index.rst @@ -316,7 +316,7 @@ the consequent renders, the default ``query_builder`` will be used:: ->add('food', FoodAutocompleteField::class, [ 'query_builder' => function (EntityRepository $er) { return $er->createQueryBuilder('o') - ->andWhere($qb->expr()->notIn('o.id', [$currentFoodId])); + ->andWhere($er->createQueryBuilder()->expr()->notIn('o.id', [$currentFoodId])); }; ]) ; From c028c193225831508ded797847751279e4d11c52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Andr=C3=A9?= Date: Sat, 22 Feb 2025 02:26:11 +0100 Subject: [PATCH 2/2] Update index.rst --- src/Autocomplete/doc/index.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Autocomplete/doc/index.rst b/src/Autocomplete/doc/index.rst index 08b51e86308..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($er->createQueryBuilder()->expr()->notIn('o.id', [$currentFoodId])); + $qb = $er->createQueryBuilder('o'); + + return $qb->andWhere($qb->expr()->notIn('o.id', [$currentFoodId])); }; ]) ;