1
0
mirror of synced 2025-02-02 21:41:45 +03:00

Update working-with-associations.rst

As requested: https://github.com/doctrine/doctrine2/pull/6171#pullrequestreview-15695400
This commit is contained in:
Thomas Landauer 2017-01-09 14:07:17 +01:00 committed by GitHub
parent f3909ae885
commit 7c168c2047

View File

@ -495,6 +495,7 @@ association, you can now create a user and persist their comments as follows:
$user = new User(); $user = new User();
$myFirstComment = new Comment(); $myFirstComment = new Comment();
$user->addComment($myFirstComment); $user->addComment($myFirstComment);
$myFirstComment->setUser($user);
$em->persist($user); $em->persist($user);
$em->flush(); $em->flush();