Skip to content

Commit

Permalink
minor #2458 [Autocomplete] Deprecate ExtraLazyChoiceLoader in favor…
Browse files Browse the repository at this point in the history
… of `LazyChoiceLoader` (norkunas)

This PR was merged into the 2.x branch.

Discussion
----------

[Autocomplete] Deprecate `ExtraLazyChoiceLoader` in favor of `LazyChoiceLoader`

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| Issues        | N/A
| License       | MIT

Commits
-------

0aadc00 [Autocomplete] Deprecate `ExtraLazyChoiceLoader` in favor of `LazyChoiceLoader`
  • Loading branch information
smnandre committed Dec 24, 2024
2 parents 261ad58 + 0aadc00 commit 58f8069
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Autocomplete/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## 2.23.0

- Deprecate `ExtraLazyChoiceLoader` in favor of `Symfony\Component\Form\ChoiceList\Loader\LazyChoiceLoader`
- Reset TomSelect when updating url attribute #1505

## 2.22.0
Expand Down
5 changes: 5 additions & 0 deletions src/Autocomplete/src/Form/BaseEntityAutocompleteType.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\ChoiceList\Loader\LazyChoiceLoader;
use Symfony\Component\Form\Exception\RuntimeException;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\Options;
Expand Down Expand Up @@ -42,6 +43,10 @@ public function configureOptions(OptionsResolver $resolver): void
return null;
}

if (class_exists(LazyChoiceLoader::class)) {
return new LazyChoiceLoader($loader);
}

return new ExtraLazyChoiceLoader($loader);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

/**
* Loads choices on demand only.
*
* @deprecated since Autocomplete 2.23 and will be removed in 3.0, use `Symfony\Component\Form\ChoiceList\Loader\LazyChoiceLoader` instead.
*/
class ExtraLazyChoiceLoader implements ChoiceLoaderInterface
{
Expand Down

0 comments on commit 58f8069

Please sign in to comment.