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

Add compatibility for #[MapEntity] (Case 178313) #16

Merged
merged 12 commits into from
Jan 6, 2025

Conversation

MalteWunsch
Copy link
Member

@MalteWunsch MalteWunsch commented Jan 3, 2025

Listen to ControllerArgumentsEvent instead of ControllerEvent. This event was introduced in Symfony 3.1 and matches our needs better:

  • We can get the controller action arguments in a more direct way and iterate over them only (typically fewer than request attributes)
  • We no longer need to care about the priority of our listener, as the ControllerArgumentsEvent is dispatched only after the arguments have been resolved
  • This allows us to get arguments resolved in other ways, e.g. via a #[MapEntity] attribute

Other improvements:

  • Declare all clases final (none of them is supposed to be extended and part of the bundle's API)
  • Refactorings: rename parameters, remove redundant logic, rename method to be more precise, refactor unit tests for conciseness

MalteWunsch and others added 8 commits January 3, 2025 15:03
None of them is supposed to be extended and part of the bundle's API.
This event was introduced in Symfony 3.1 and matches our needs better:

- We can get the controller action arguments in a more direct way and iterate over them only (typically fewer than request attributes)
- We no longer need to care about the priority of our listener, as the ControllerArgumentsEvent is dispatched only after the arguments have been resolved
- This allows us to get arguments resolved in other ways, e.g. via a MapEntity attribute
@MalteWunsch MalteWunsch changed the title Add compatibility for #[MapEntity] (Case 178313) Add compatibility for #[MapEntity] (Case 178313) Jan 3, 2025
@MalteWunsch MalteWunsch marked this pull request as ready for review January 3, 2025 20:51
@MalteWunsch MalteWunsch merged commit b35a956 into master Jan 6, 2025
5 checks passed
@MalteWunsch MalteWunsch deleted the 178313-compatibility-for-mapentity-attribute branch January 6, 2025 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant