Skip to content

Commit 25278fd

Browse files
committed
bug #1775 #1770 [Autocomplete] Ignore the ExtraLazyChoiceLoader if the parent $loader is null (vesselind)
This PR was merged into the 2.x branch. Discussion ---------- #1770 [Autocomplete] Ignore the ExtraLazyChoiceLoader if the parent $loader is null | Q | A | ------------- | --- | Bug fix? | yes/no | New feature? | no | Issues | Fix #1770 | License | MIT When a custom autoload field class is created and `choices` option is passed, an error occurs: `Symfony\UX\Autocomplete\Form\ChoiceList\Loader\ExtraLazyChoiceLoader::__construct(): Argument #1 ($decorated) must be of type Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface, null given`. This should fix the problem, described in #1770. Commits ------- 28af7fc #1770 ignore the ExtraLazyChoiceLoader if the parent $loader is null
2 parents c852c5a + 28af7fc commit 25278fd

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Autocomplete/src/Form/BaseEntityAutocompleteType.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
3838
public function configureOptions(OptionsResolver $resolver): void
3939
{
4040
$choiceLoader = static function (Options $options, $loader) {
41+
if (null === $loader) {
42+
return null;
43+
}
44+
4145
return new ExtraLazyChoiceLoader($loader);
4246
};
4347

0 commit comments

Comments
 (0)