Skip to content

Load methods return a new instance (distinguish strictly between model and entity)#862

Merged
mvorisek merged 32 commits intodevelopfrom
distinguish_model_and_entity
May 5, 2021
Merged

Load methods return a new instance (distinguish strictly between model and entity)#862
mvorisek merged 32 commits intodevelopfrom
distinguish_model_and_entity

Conversation

@mvorisek
Copy link
Copy Markdown
Member

@mvorisek mvorisek commented Apr 23, 2021

For 3.0 release 🚀

Definitions

MODEL

Instance of Model class that is supposed to model data/relations, but can not hold/contain any record data.

ENTITY

Instance of Model class 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.

@mvorisek mvorisek force-pushed the distinguish_model_and_entity branch 6 times, most recently from aef589b to 6b0789e Compare April 24, 2021 07:11
@mvorisek mvorisek marked this pull request as ready for review April 24, 2021 07:13
@mvorisek mvorisek marked this pull request as draft April 24, 2021 07:13
@mvorisek mvorisek force-pushed the distinguish_model_and_entity branch 9 times, most recently from 40a2332 to 8955b81 Compare April 25, 2021 07:54
@mvorisek mvorisek force-pushed the distinguish_model_and_entity branch 9 times, most recently from d30fe88 to 9f51887 Compare April 25, 2021 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants