I
I
ince2020-08-26 16:56:32
Design patterns
ince, 2020-08-26 16:56:32

What is the difference between schema, model and entity?

What is the difference between schema, model and entity?
MVC

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim, 2020-08-26
@Tomio

If I understand correctly what you want to know, then this is the story.
A model is an object described in the code, a class that is needed for manipulation at the abstraction level. The model serves as a wrapper over the entity. You simply describe in it all the properties and methods inherent in it (if they are needed). For example, you can create a database table model (inheriting from some base model), in which you describe all properties (columns), specify their (column) parameters, etc.
An entity is what the model stores, a unique instance , obtained from the model. That is, if it was a database table model, then the entity will be a specific record with a primary key.
Schemeis the connection of the models. That is the scheme of their interaction. If we take the same database table model, then if it has a foreign key to another table, then they will have a connection and a scheme of interaction between themselves through their models.

M
Maxim Fedorov, 2020-08-26
@Maksclub

Model - some abstraction of what we design (model):
- or a business abstraction model, whether it be entities (payment, goods, order) with a state or whether it is business processes (ordering goods, writing off balance for purchase, dismissal) without state or collection
- or a data/storage model (e.g. images)
- or a model of anything that we have designed, except for infrastructure details and related details (controllers for example), if this is not the basic essence of our code
Entity - a business model , which has an explicit identifier and its own state (a specific document, a specific user, a specific payment, where the specificity is due to some unique identifier
)- an abstract plan of something (connections or processes for example)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question