ux
ux copied to clipboard
[Autocomplete] Autocomplete URL must be provided without attribute
Currently when using #[AsEntityAutocompleteField] route ux_entity_autocomplete is automatically configured if not explicitly provided.
Would be nice to have a possibility also to use this default when just tagging via service config:
<?php
declare(strict_types=1);
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
use Symfony\UX\Autocomplete\DependencyInjection\AutocompleteFormTypePass;
return static function (ContainerConfigurator $container): void {
$container->services()
->defaults()
->private();
$container->services()
->set('custom_autocomplete_field', CustomAutocompleteField::class)
->tag('form.type')
->tag(AutocompleteFormTypePass::ENTITY_AUTOCOMPLETE_FIELD_TAG, ['alias' => 'custom'])
;
};
Or at least to provide it via AutocompleteFormTypePass::ENTITY_AUTOCOMPLETE_FIELD_TAG tag attribute otherwise in each AutocompleteField I need to inject UrlGenerator and generate the url because ParentEntityAutocompleteType expects autocomplete_url to be absolute.
Hey @norkunas!
Can you explain what you're proposing a bit more?
Currently when using #[AsEntityAutocompleteField] route
ux_entity_autocompleteis automatically configured if not explicitly provided.
This route is never automatically added - it's imported by the user via https://github.com/symfony/recipes/blob/main/symfony/ux-autocomplete/2.6/config/routes/ux_autocomplete.yaml - so I think you mean something else, but I'm not sure what it is :)
Maybe you can post some code you currently need to write and show how you'd like it to be different.
Cheers!
Yes, I know that it's imported by user, but the attribute carries default route name,so I think it should be same when just tagging it manually :)
Thank you for this issue. There has not been a lot of activity here for a while. Has this been resolved?
Not resolved
Thank you for this issue. There has not been a lot of activity here for a while. Has this been resolved?
Just a quick reminder to make a comment on this. If I don't hear anything I'll close this.
Hey,
I didn't hear anything so I'm going to close it. Feel free to comment if this is still relevant, I can always reopen!