-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Proposal: partial objects, lazy load for field access #5659
Comments
Instead of packing more complexity into an entity/PHP-object (by having lazy-loaded fields), what about taking the opposite approach? Give users a mechanism to map a single database row to multiple entities with non-overlapping field-responsibilities. For example, suppose you're forced to deal with some legacy This would obviously complicate things in terms of identity-mapping and how commits have to occur, but it would bypass a whole lot of potential PHP-land problems with proxies and inheritance and interfaces. |
We're actually simplifying the entire proxy stuff there
That is also in the works. @guilhermeblanco was looking into a way to define hydration manually via M:N field mappings.
It wouldn't complicate anything if hydration/extraction (and associated testing) are delegated to the user for edge-cases. We're very far from that tho, and generating proxies for partial objects is actually already available. |
Partial objects have been deprecated/removed, some alternative solutions can be found here: #8471 |
The documentation tells that it is not possible in PHP:
But my opinion that it is possible to do through magic methods (
__get
and__set
). However there still one problem: the syntax highlighting. This can be solved with a@property
annotation, which is supported with all contemporary IDEs.The ActiveRecord realization in Yii2 uses similar approach.
The text was updated successfully, but these errors were encountered: