Skip to content
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

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

Merged
merged 32 commits into from May 5, 2021

Conversation

mvorisek
Copy link
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
src/Model.php Show resolved Hide resolved
@mvorisek mvorisek force-pushed the distinguish_model_and_entity branch 9 times, most recently from d30fe88 to 9f51887 Compare April 25, 2021 20:57
@mvorisek mvorisek force-pushed the distinguish_model_and_entity branch from cb78074 to bb53f41 Compare May 5, 2021 18:05
@mvorisek mvorisek merged commit ad7d9ce into develop May 5, 2021
@mvorisek mvorisek deleted the distinguish_model_and_entity branch May 5, 2021 18:11
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.

None yet

3 participants