Skip to content

Commit 51b5f79

Browse files
committed
[Autocomplete] Deprecate ExtraLazyChoiceLoader in favor of LazyChoiceLoader
1 parent dec3eb3 commit 51b5f79

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

src/Autocomplete/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# CHANGELOG
22

3+
## 2.23.0
4+
5+
- Deprecate `ExtraLazyChoiceLoader` in favor of `Symfony\Component\Form\ChoiceList\Loader\LazyChoiceLoader`
6+
37
## 2.22.0
48

59
- Take `labelField` TomSelect option into account #2382

src/Autocomplete/src/Form/BaseEntityAutocompleteType.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
1515
use Symfony\Component\Form\AbstractType;
16+
use Symfony\Component\Form\ChoiceList\Loader\LazyChoiceLoader;
1617
use Symfony\Component\Form\Exception\RuntimeException;
1718
use Symfony\Component\Form\FormBuilderInterface;
1819
use Symfony\Component\OptionsResolver\Options;
@@ -42,6 +43,10 @@ public function configureOptions(OptionsResolver $resolver): void
4243
return null;
4344
}
4445

46+
if (class_exists(LazyChoiceLoader::class)) {
47+
return new LazyChoiceLoader($loader);
48+
}
49+
4550
return new ExtraLazyChoiceLoader($loader);
4651
};
4752

src/Autocomplete/src/Form/ChoiceList/Loader/ExtraLazyChoiceLoader.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
/**
1919
* Loads choices on demand only.
20+
*
21+
* @deprecated since 2.23, use `Symfony\Component\Form\ChoiceList\Loader\LazyChoiceLoader` instead.
2022
*/
2123
class ExtraLazyChoiceLoader implements ChoiceLoaderInterface
2224
{

0 commit comments

Comments
 (0)