BenMakesGames/PoppySeedPets
controllers should use bespoke request DTOs instead of the `Request` service
Offen
#18 geöffnet am 05.04.2025
good first issuetech debt
Repository-Metriken
- Stars
- (14 Sterne)
- PR-Merge-Metriken
- (PR-Metriken ausstehend)
Beschreibung
Symfony added this feature a bit ago: https://symfony.com/blog/new-in-symfony-6-3-mapping-request-data-to-typed-objects
the LogInController uses it, but few other endpoints do. upgrade all controllers that handle requests to use them.
other notes:
- if you find a controller that really feels like "nah, it should keep using
Request", add a comment explaining whyRequestis being used instead of a request DTO - request DTOs must live in the same file as the controller that uses them
- do not fall for the trap of "false sameness" - 99%+ of request DTOs have no business being shared between multiple endpoints
it's totally legit to upgrade just one endpoint or a small group of endpoints in a PR; this issue will be closed when no controllers remain which are using Request.