Skip to content

Commit 53318e1

Browse files
committed
Merge branch '3.4' into 4.2
* 3.4: Added a note about N+1 problem and form collections
2 parents f60923b + 2a01088 commit 53318e1

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

doctrine/associations.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,8 @@ by adding JOINs.
450450
all at once (via a *join*), Doctrine will return the *true* ``Category``
451451
object, since nothing needs to be lazily loaded.
452452

453+
.. _doctrine-associations-join-query:
454+
453455
Joining Related Records
454456
-----------------------
455457

reference/forms/types/entity.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,13 @@ the `query_builder`_ option::
105105
'choice_label' => 'username',
106106
]);
107107

108+
.. note::
109+
110+
Using form collections may result in making too many database requests to
111+
fetch related entities. This is known as the *"N + 1 query problem"* and it
112+
can be solved by :ref:`joining related records <doctrine-associations-join-query>`
113+
when querying for Doctrine associations.
114+
108115
.. _reference-forms-entity-choices:
109116

110117
Using Choices

0 commit comments

Comments
 (0)