Load methods return a new instance (distinguish strictly between model and entity)#862
Merged
Load methods return a new instance (distinguish strictly between model and entity)#862
Conversation
aef589b to
6b0789e
Compare
40a2332 to
8955b81
Compare
mvorisek
commented
Apr 25, 2021
d30fe88 to
9f51887
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For 3.0 release 🚀
Definitions
MODEL
Instance of
Modelclass that is supposed to model data/relations, but can not hold/contain any record data.ENTITY
Instance of
Modelclass that is supposed to hold/contain record data, but they can be modelled only using MODEL (described above).The instance/object is locked with specific ID once it is loaded/inserted from/to DB.
Migration
Model data like now. To manipulate with the actual data, you need to create another instance from MODEL using
createEntity()method to create a new entity or using{,try}load{,One,Any}()methods which now return a new instance - ENTITY.Mistake safety
If and only if we can distinguish strictly between model and entity, then all wrong usage will throw and no code can keep working if used wrongly.