A
A
Alexey2018-11-05 10:31:48
Doctrine ORM
Alexey, 2018-11-05 10:31:48

Doctrine how to bind entities?

Hello dear developers. I just started getting acquainted with doctrine, so I stumble over simple questions. And now, specifically, I can’t link several entities one-to-one. There is one basic entity, let's call it Token with fields id, userId, token and several others with an approximate structure - id, userId, ...something. According to the application logic, when requesting data from the database for any of these entities, it is also necessary to pull up data about the user token. All entities intersect by the key userId. Those. Once again, in tables, there is no token field, except for the Token entity and its tokens table. And as a hypothetical example, a getAll or findByUserId request is made to the payments table, so it is necessary that in the resulting array, the token property of the Payment entity receives the value corresponding to the entry from the tokens table (ex. Token).

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vadim, 2018-11-05
@kylt_lichnosti

Read somewhere here.
https://symfony.com/doc/current/doctrine/associati...
and here
https://www.doctrine-project.org/projects/doctrine...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question