-
-
Notifications
You must be signed in to change notification settings - Fork 399
[LiveComponent] add controller tag and default metadata values for all service declaration types #3143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 2.x
Are you sure you want to change the base?
Conversation
…l service declaration types
b5dd556 to
d6c45ba
Compare
|
Hi, For the same reasons explained in #3064, I'm 👎 here. The tag is purely internal and not documented, I don't think we want to encourage users to rely on it.
Why? Because of "DDD"? |
| $url = $this->urlGenerator->generate( | ||
| $metadata->get('route') ?? 'ux_live_component', | ||
| ['_live_component' => $mounted->getName()], | ||
| $metadata->get('url_reference_type') ?? UrlGeneratorInterface::ABSOLUTE_PATH |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand the question (since I explained why in the PR description).
If we manually declare the service in the YAML file, we have to provide this additional information.
These default internal values are precisely designed to prevent this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry i missclicked on the line apparently.. i was asking about the AbsolutePath as default
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi,
I use the same defaults values as the attribute, visible here : https://github.com/symfony/ux/blob/2.x/src/LiveComponent/src/Attribute/AsLiveComponent.php#L51
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method:POST is also mandatory in some cases
|
Hi @Kocal ,
We use DDD but it's not the reason. We could accept to use attributes in the infrastructure layer but we do not use autowiring and autoconfigure features (my client's rules). And since this service declaration is still possible, I find it unfortunate that it cannot be used without exposing internal properties as I demonstrate. |
In my project I don't use attributes like
#[AsLiveComponent]in order to declare services and live components but I use yaml files (not my choice).It works fine for all my services but live components are not well supported because we have to add extra parameters.
With
#[AsLiveComponent]attribute, we have default values for :'ux_live_component'UrlGeneratorInterface::ABSOLUTE_PATHWe also add
controller.service_argumentstag inLiveComponentExtensionclass.But if we don't use this attribute and we want to use another type of service declaration, we have to add all these information :
If we do not, we have errors likes theses :
These errors do not exist for php attribute declaration so I made this PR to have the same behavior regardless of how the live component is declared