Skip to content

Add draft MapRequestDto action mapping#19244

Draft
dereuromark wants to merge 1 commit intocakephp:5.nextfrom
dereuromark:draft/map-request-dto
Draft

Add draft MapRequestDto action mapping#19244
dereuromark wants to merge 1 commit intocakephp:5.nextfrom
dereuromark:draft/map-request-dto

Conversation

@dereuromark
Copy link
Member

@dereuromark dereuromark commented Feb 4, 2026

Summary

  • add MapRequestDto attribute for controller action parameters
  • map request data into DTOs via ControllerFactory when the attribute is present
  • add tests and a test DTO for coverage

Notes

  • relies on a createFromArray() convention, no interface required

This would essentially port dereuromark/cakephp-dto#99 into core level.
If thats out of scope, and it should remain plugin level, feel free to close.

@dereuromark dereuromark changed the base branch from 5.x to 5.next February 4, 2026 19:10
@dereuromark dereuromark added this to the 5.4.0 milestone Feb 5, 2026
@LordSimal
Copy link
Contributor

So with this we would be able to selectively get a more type-safe variant for

  • $this->request->getData()
  • $this->request->getQueryParams()

per action, as we would be able to manually map request or query data to DTO properties, right?

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants