Skip to content

Commit 6138afd

Browse files
authored
[Docs] Make clear that calling remove() detaches the object (doctrine#8081)
I changed a relationship from eager to lazy loading which broker the behaviour of my application in regards to object removal. It was not clear for me that removing an object detaches it and subsequent calls like contains() in a OneToMany relationship with the object scheduled for removal will return false afterwards.
1 parent dafe298 commit 6138afd

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

docs/en/reference/working-with-objects.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,13 @@ in multiple ways with very different performance impacts.
330330
because Doctrine will fetch and remove all associated entities
331331
explicitly nevertheless.
332332

333+
.. note::
334+
335+
Calling ``remove`` on an entity will remove the object from the identiy
336+
map and therefore detach it. Querying the same entity again, for example
337+
via a lazy loaded relation, will return a new object.
338+
339+
333340
Detaching entities
334341
------------------
335342

0 commit comments

Comments
 (0)