A
A
Alexander2016-07-24 11:49:23
PHP
Alexander, 2016-07-24 11:49:23

When are ActiveRecord or Doctrine used?

When are ActiveRecord or Doctrine used? Is the usual use of a PDO wrapper starting to be considered bad manners?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
OnYourLips, 2016-07-24
@OnYourLips

Is the usual use of a PDO wrapper starting to be considered bad manners?
Starts? In the last century (when there was no PDO yet) it was already considered.
You cannot mix logic from different application layers (Data Source Layer and Service Layer). Without AR/DM, you would have to be very verbose to manually write the necessary queries at a separate level.

A
Andrey Kulikovsky, 2016-07-24
@by25

It makes sense to use ActiveRecord if your model fits well with a relational data structure. Those. class properties correspond to table fields.
For complex business logic, a doctrine is better, it maps data from tables to our domain objects and the structure of subd tables can be very different from the structure of our model. The doctrine also includes many great things such as UnitOfWork, EntityManager and a bunch of other handy things.
For most sites and simple projects, active record is a good option. For complex projects - Doctrine.
OnYourLips answered above about using orm vs pdo

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question