A
A
Alexey Verkhovtsev2019-04-12 18:27:35
symfony
Alexey Verkhovtsev, 2019-04-12 18:27:35

How to get entities from Symfony 4 database more efficiently?

There is a workspace that has sites, they are connected.
I see 2 options
1) write a method in which I will pass the workspace id and write a request through the builder
2) get the workspace itself by the workspace id and pull out sites through it
The problem is that as far as I know in option 2 it will make 2 requests to the database, the first to pull the workspace, and 2 when accessing sites directly to pull them. (but this behavior should somehow change)
I ask for advice
PS if you disable lazy loading, is there a difference between the options?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question