Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions UPGRADE-3.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,30 @@ the [Symfony documentation](https://symfony.com/doc/6.4/setup/upgrade_major.html
>
> Requires Symfony `6.4` or higher.

## Autocomplete

* The class `ParentEntityAutocompleteType` has been removed in favor of `BaseEntityAutocompleteType`:
```diff
-use Symfony\UX\Autocomplete\Form\ParentEntityAutocompleteType;
+use Symfony\UX\Autocomplete\Form\BaseEntityAutocompleteType;

#[AsEntityAutocompleteField]
class FoodAutocompleteField extends AbstractType
{
// ...

public function getParent(): string
{
- return ParentEntityAutocompleteType::class;
+ return BaseEntityAutocompleteType::class;
}
}
```

* The class `ExtraLazyChoiceLoader` has been removed in favor of
`Symfony\Component\Form\ChoiceList\Loader\LazyChoiceLoader` from Symfony Form >=7.2,
run `composer require symfony/form:>=7.2"` if you don't have it installed yet.

## LazyImage

* The package has been removed, see the [previous README](https://raw.githubusercontent.com/symfony/ux/refs/heads/2.x/src/LazyImage/README.md)
Expand Down
3 changes: 3 additions & 0 deletions src/Autocomplete/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

- Minimum required Symfony version is now 6.4
- Minimum required PHP version is now 8.2
- Remove `ParentEntityAutocompleteType` in favor of `BaseEntityAutocompleteType`
- Remove `ExtraLazyChoiceLoader` in favor of `Symfony\Component\Form\ChoiceList\Loader\LazyChoiceLoader` from Symfony Form >=7.2
- Add parameter `$security` to `AutocompleteResultsExecutor::__construct()`

## 2.30

Expand Down
2 changes: 1 addition & 1 deletion src/Autocomplete/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"doctrine/orm": "^2.9.4|^3.0",
"fakerphp/faker": "^1.22",
"mtdowling/jmespath.php": "^2.6",
"symfony/form": "^6.4|^7.0|^8.0",
"symfony/form": "^7.2|^8.0",
"symfony/options-resolver": "^6.4|^7.0|^8.0",
"symfony/framework-bundle": "^6.4|^7.0|^8.0",
"symfony/maker-bundle": "^1.40",
Expand Down
16 changes: 2 additions & 14 deletions src/Autocomplete/src/AutocompleteResultsExecutor.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use Doctrine\ORM\Tools\Pagination\Paginator;
use Symfony\Bundle\SecurityBundle\Security;
use Symfony\Component\PropertyAccess\Exception\UnexpectedTypeException;
use Symfony\Component\PropertyAccess\PropertyAccessor;
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
use Symfony\Component\PropertyAccess\PropertyPath;
use Symfony\Component\PropertyAccess\PropertyPathInterface;
Expand All @@ -26,22 +25,11 @@
*/
final class AutocompleteResultsExecutor
{
private PropertyAccessorInterface $propertyAccessor;
private ?Security $security;

public function __construct(
private DoctrineRegistryWrapper $managerRegistry,
$propertyAccessor,
/* Security $security = null */
private PropertyAccessorInterface $propertyAccessor,
private ?Security $security = null,
) {
if ($propertyAccessor instanceof Security) {
trigger_deprecation('symfony/ux-autocomplete', '2.8.0', 'Passing a "%s" instance as the second argument of "%s()" is deprecated, pass a "%s" instance instead.', Security::class, __METHOD__, PropertyAccessorInterface::class);
$this->security = $propertyAccessor;
$this->propertyAccessor = new PropertyAccessor();
} else {
$this->propertyAccessor = $propertyAccessor;
$this->security = \func_num_args() >= 3 ? func_get_arg(2) : null;
}
}

public function fetchResults(EntityAutocompleterInterface $autocompleter, string $query, int $page): AutocompleteResults
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
use Symfony\UX\Autocomplete\Form\AsEntityAutocompleteField;
use Symfony\UX\Autocomplete\Form\AutocompleteChoiceTypeExtension;
use Symfony\UX\Autocomplete\Form\BaseEntityAutocompleteType;
use Symfony\UX\Autocomplete\Form\ParentEntityAutocompleteType;
use Symfony\UX\Autocomplete\Form\WrappedEntityTypeAutocompleter;
use Symfony\UX\Autocomplete\Maker\MakeAutocompleteField;

Expand Down Expand Up @@ -147,14 +146,6 @@ private function registerFormServices(ContainerBuilder $container): void
])
->addTag('form.type');

$container
->register('ux.autocomplete.entity_type', ParentEntityAutocompleteType::class)
->setDeprecated('symfony/ux-autocomplete', '2.13', 'The "%service_id%" form type is deprecated since 2.13. Use "ux.autocomplete.base_entity_type" instead.')
->setArguments([
new Reference('router'),
])
->addTag('form.type');

$container
->register('ux.autocomplete.choice_type_extension', AutocompleteChoiceTypeExtension::class)
->setArguments([
Expand Down
11 changes: 0 additions & 11 deletions src/Autocomplete/src/Doctrine/EntityMetadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,6 @@ public function isEmbeddedClassProperty(string $propertyName): bool
return \array_key_exists($propertyNameParts[0], $this->metadata->embeddedClasses);
}

public function getPropertyMetadata(string $propertyName): array
{
trigger_deprecation('symfony/ux-autocomplete', '2.15.0', 'Calling EntityMetadata::getPropertyMetadata() is deprecated. You should stop using it, as it will be removed in the future.');

try {
return $this->getFieldMetadata($propertyName);
} catch (\InvalidArgumentException $e) {
return $this->getAssociationMetadata($propertyName);
}
}

/**
* @internal
*
Expand Down
110 changes: 0 additions & 110 deletions src/Autocomplete/src/Form/AutocompleteEntityTypeSubscriber.php

This file was deleted.

7 changes: 3 additions & 4 deletions src/Autocomplete/src/Form/BaseEntityAutocompleteType.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\UX\Autocomplete\Form\ChoiceList\Loader\ExtraLazyChoiceLoader;

/**
* All form types that want to expose autocomplete functionality should use this for its getParent().
Expand All @@ -43,11 +42,11 @@ public function configureOptions(OptionsResolver $resolver): void
return null;
}

if (class_exists(LazyChoiceLoader::class)) {
return new LazyChoiceLoader($loader);
if (!class_exists(LazyChoiceLoader::class)) {
throw new \LogicException(\sprintf('Using "%s" with "%s" requires symfony/form >= 7.2 to be installed. Try running "composer require symfony/form:>=7.2".', LazyChoiceLoader::class, __CLASS__));
}

return new ExtraLazyChoiceLoader($loader);
return new LazyChoiceLoader($loader);
};

$resolver->setDefaults([
Expand Down

This file was deleted.

Loading
Loading