Skip to content

Commit 88da4b7

Browse files
committed
Merge branch '4.2'
* 4.2: Added a note about N+1 problem and form collections
2 parents b669038 + 53318e1 commit 88da4b7

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
@@ -110,6 +110,13 @@ the `query_builder`_ option::
110110
'choice_label' => 'username',
111111
]);
112112

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

115122
Using Choices

0 commit comments

Comments
 (0)