Skip to content

Commit 9cf1a01

Browse files
committed
minor #2470 [Autocomplete] Fix invalid createQueryBuilder code example (tacman, smnandre)
This PR was merged into the 2.x branch. Discussion ---------- [Autocomplete] Fix invalid createQueryBuilder code example replace with creating it from the entity repository Commits ------- c028c19 Update index.rst 27e539b replace undefined $qb
2 parents 004546b + c028c19 commit 9cf1a01

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Autocomplete/doc/index.rst

+3-2
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,9 @@ the consequent renders, the default ``query_builder`` will be used::
315315
$builder
316316
->add('food', FoodAutocompleteField::class, [
317317
'query_builder' => function (EntityRepository $er) {
318-
return $er->createQueryBuilder('o')
319-
->andWhere($qb->expr()->notIn('o.id', [$currentFoodId]));
318+
$qb = $er->createQueryBuilder('o');
319+
320+
return $qb->andWhere($qb->expr()->notIn('o.id', [$currentFoodId]));
320321
};
321322
])
322323
;

0 commit comments

Comments
 (0)