How to call a class that has access to the database?

Good evening.
In MVC do that often model. But what about in General? Now for the use of the Repository, and that repository is a database, it remains an implementation detail (something tells me that this decision is far-fetched and semantically incorrect). At the same time, Yii has ActiveRecord which is bound to the table, and by many is called the model.

So what is typically the class, empowered to access the database to retrieve / save a specific entity, for example, User? And how better to do, to bind these classes to the entity or to the table?

Thanks in advance.
June 8th 19 at 16:52
2 answers
June 8th 19 at 16:54
Solution
Yii ActiveRecord is tied to the table

But he does it in a few abstractions...
In the Yii2 for the work with database answers https://github.com/yiisoft/yii2/blob/master/framew...

And how better to do, to bind these classes to the entity or to the table?

You kind of work through the repository
Here is a good and popular pattern that solves your case:
design-pattern.ru/patterns/data-mapper.html
Thanks, nice website) - Annabelle_Schoen commented on June 8th 19 at 16:57
June 8th 19 at 16:56
Solution
DAO - Data Access Object. The name speaks. The link to the wiki
Good option, thanks - Annabelle_Schoen commented on June 8th 19 at 16:59

Find more questions by tags OOPProgramming