Doctrine ORM: can't MapIT entire objects?

The task is to read from tables in database (PostgreSQL) a couple of columns with Doctrine.

Question: is it possible to do this using ORM? At the same time I do not want (not need) to read all the columns, you only need a few values.

Clarification: in the future, you may need not only read from this table and write into it.
April 3rd 20 at 18:53
1 answer
April 3rd 20 at 18:55
Solution
can't MapIT entire objects?

You can forget about crutches with the mapping of some fields of the object, and to describe separate DTO classes with the desired fields.

Documentation - https://www.doctrine-project.org/projects/doctrine...

p.s. Essence when using DataMapper != a sign in the database.
And what of the crutches, more? - Assunta_Sauer commented on April 3rd 20 at 18:58
@Assunta_Sauer, the Purpose of the doctrine is MapIT your objects with the business logic(entities) in the database so that the entity about the warehouse knew nothing.

If the data is needed for reading the (display to user, etc) - you can select them using SQL/DQL and snapit on individual objects with the right fields. - laron.Boehm commented on April 3rd 20 at 19:01
@Assunta_Sauer,
Question: is it possible to do this using ORM? At the same time I do not want (not need) to read all the columns, you only need a few values.

And what of the crutches, more?

Crutches — read the part of the entity. That eats ivam need information ABOUT the BUSINESS OBJECT (with behavior and a limited number of States), and only part of the data (data) to transmit (transfer) somewhere... for this is a DATA TRANSFER OBJECT (DTO), et Onet purpose of an entity...

Above the link gave, in the ATT of mappit data from the database, pass in the entity - tiffany35 commented on April 3rd 20 at 19:04

Find more questions by tags Doctrine ORM