Skip to content

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.

2 participants