Skip to content

Work attribute MapQueryParameter with UidValueResolver #51618

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

Closed
pilot114 opened this issue Sep 10, 2023 · 7 comments · Fixed by #58717
Closed

Work attribute MapQueryParameter with UidValueResolver #51618

pilot114 opened this issue Sep 10, 2023 · 7 comments · Fixed by #58717

Comments

@pilot114
Copy link

Description

Currently, UidValueResolver only works with request attributes. However, the MapQueryParameter accepts a "resolver" parameter, which means you can flexibly bind query parameters with different resolvers.

In general, it is possible that the problem is somewhat broader: resolvers could work on all attributes where "resolver" parameter passing is possible. At least within the package http-kernel

Example

It would be great if the following combination would work:

#[MapQueryParameter(resolver: UidValueResolver::class)] ?Uuid $groupId = null

@pilot114 pilot114 changed the title Work attribute MapQueryParameter with UidValueResolver by default Work attribute MapQueryParameter with UidValueResolver Sep 10, 2023
@OskarStark OskarStark changed the title Work attribute MapQueryParameter with UidValueResolver Work attribute MapQueryParameter with UidValueResolver Oct 10, 2023
@carsonbot
Copy link

Thank you for this suggestion.
There has not been a lot of activity here for a while. Would you still like to see this feature?

@carsonbot
Copy link

Friendly ping? Should this still be open? I will close if I don't hear anything.

@carsonbot
Copy link

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!

@pilot114
Copy link
Author

yes, this is still a valid request

@xabbuh
Copy link
Member

xabbuh commented May 13, 2024

Would you like to give it a try?

@seb-jean
Copy link
Contributor

seb-jean commented May 28, 2024

I would also be interested in a PR.

We should take an example from the following PR : #51004
And also on the file: https://github.com/symfony/symfony/blob/7.0/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/UidValueResolver.php

Should we modify the QueryParameterValueResolver?

@seb-jean
Copy link
Contributor

@pilot114 Do you feel capable of doing PR?

fabpot added a commit that referenced this issue Feb 7, 2025
…seb-jean)

This PR was squashed before being merged into the 7.3 branch.

Discussion
----------

[HttpKernel] Support `Uid` in `#[MapQueryParameter]`

| Q             | A
| ------------- | ---
| Branch?       | 7.3
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Issues        | Fix #51618
| License       | MIT

I added support `Uid` in `#[MapQueryParameter]`.  To use it, you must do this:

```php
#[Route(path: '/', name: 'user_show')]
public function indexAction(
    #[MapQueryParameter] ?Ulid $groupId = null,
)
```

Commits
-------

9fd614a [HttpKernel] Support `Uid` in `#[MapQueryParameter]`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants