Skip to content

Conversation

@dereuromark
Copy link
Member

Summary

  • Documents the new projectAs() method for projecting ORM query results into DTOs instead of Entity objects
  • Adds section on DTO creation methods (reflection-based and factory method patterns)
  • Documents the #[CollectionOf] attribute for nested association DTOs
  • Adds migration guide entries for 5.3

Refs cakephp/cakephp#19135

Documents the new projectAs() method for projecting ORM results
into DTOs instead of Entity objects, including the #[CollectionOf]
attribute for nested associations.

Refs cakephp/cakephp#19135
@dereuromark dereuromark changed the base branch from 5.x to 5.next December 30, 2025 04:24
@LordSimal
Copy link
Contributor

I'd extend the docs to contain an example for e.g. an API response based DTO so our users know, that DTO's can also be used outside of the ORM/Table ecosystem.

@markstory markstory added this to the 5.next milestone Dec 31, 2025
Comment on lines +181 to +183
Transfer Objects (DTOs) instead of Entity objects. DTOs provide a
memory-efficient alternative (approximately 3x less memory than entities) for
read-only data access. See :ref:`dto-projection`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we also want to highlight the differences from arrays like typehinting, IDE support, and separating serialization logic/output from storage schema?

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.

4 participants