Skip to content
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

[LiveComponent] Multiple URL query params in one LiveProp DTO #2142

Open
Nayte91 opened this issue Sep 9, 2024 · 1 comment
Open

[LiveComponent] Multiple URL query params in one LiveProp DTO #2142

Nayte91 opened this issue Sep 9, 2024 · 1 comment

Comments

@Nayte91
Copy link

Nayte91 commented Sep 9, 2024

Hello,

Part of the discussion about faceted search menu and results page combo (challenge 1), I'm searching to map different url parameters into one object.

In a symfony controller, you can welcome several query params in a single DTO with the MapQueryString attribute.

I wonder if we can, also in live components, group several query params into one property class?

In a live component, currently, when you have multiple query parameters to welcome, you must declare them one by one; then eventually, in a method, regroup them into an array or a DTO to do some logic. It can be cumbersome if you have a lot of potential query parameters. Plus, and I feel like it's more important, aligning behavior of component controllers (like a LC), with regular controllers is very important as it drastically lowers the mind burden and learning curve.

Context: you got a FacetedSearchMenu component, with multiple parameters that you want to reflect on url, and you group those in a FacetFilter DTO to pass to repository or whatever.

If I may help in any way,
Best regards,

@Nayte91 Nayte91 added the RFC label Sep 9, 2024
@Nayte91 Nayte91 changed the title [LiveComponent] Multiple url query params in one LiveProp [LiveComponent] Multiple URL query params in one LiveProp DTO Sep 29, 2024
@Nayte91
Copy link
Author

Nayte91 commented Oct 2, 2024

Possibilities:

  • new #[LiveQueryString] attribute?
  • make #[mapQueryString] works on a LC (without extending AbstractController?)
  • make url: true works on a DTO

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants