S
S
Sergey Nizhny Novgorod2018-10-23 10:04:40
Doctrine ORM
Sergey Nizhny Novgorod, 2018-10-23 10:04:40

How to pull out all dependent tables at once in the doctrine?

Hello everyone
Task: I pull the article object from the knowledge base, through twig I get all the dependent data (comments, ratings, ratings - everything from each separate table).
For example, in Django ORM, if I do this, then for each request to another table there is a separate subquery, which greatly slows down the work. For such purposes, you can make a complex request there, which will immediately pull out all the dependencies. Is there an analog for this in Doctrine?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis, 2018-10-23
@Terras

there are two ways
- in essence (but then it will work anyway)

/**
     * @ORM\OneToMany(targetEntity="Grade", mappedBy="user", fetch="EAGER")
     * @ORM\OrderBy({"createdAt" = "DESC"})
     */

either in the repository make an appropriate request with the appropriate join

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question