Update working-with-associations.rst
As requested: https://github.com/doctrine/doctrine2/pull/6171#pullrequestreview-15695400
This commit is contained in:
parent
f3909ae885
commit
7c168c2047
@ -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();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user