From a8a3a8c9e7796e8984ff76e31a7f48adb5357a63 Mon Sep 17 00:00:00 2001 From: Thomas Landauer Date: Sun, 18 Dec 2016 21:58:44 +0100 Subject: [PATCH] Update working-with-associations.rst --- docs/en/reference/working-with-associations.rst | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/en/reference/working-with-associations.rst b/docs/en/reference/working-with-associations.rst index 0768c3ede..106da34ec 100644 --- a/docs/en/reference/working-with-associations.rst +++ b/docs/en/reference/working-with-associations.rst @@ -513,8 +513,14 @@ association, you can now create a user and persist his comment as follows: $em->persist($user); $em->flush(); -Even though automatic cascading is convenient it should be used -with care. Do not blindly apply cascade=all to all associations as +.. note:: + + This code does not associate the newly created comment with the user. + To achieve this, you *always* have to call ``$myFirstComment->setUser($user);`` – + no matter if ``cascade: persist`` is set or not. + +Even though automatic cascading is convenient, it should be used +with care. Do not blindly apply ``cascade=all`` to all associations as it will unnecessarily degrade the performance of your application. For each cascade operation that gets activated Doctrine also applies that operation to the association, be it single or