-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: persist and flush fixtures only once, and remove call to clone
- Loading branch information
1 parent
437e674
commit 68db9c6
Showing
2 changed files
with
4 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,6 @@ public function load(ObjectManager $manager): void | |
$user->setEmail('[email protected]'); | ||
|
||
$manager->persist($user); | ||
$manager->flush(); | ||
|
||
$this->addReference('user', $user); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,13 +32,14 @@ public function load(ObjectManager $manager): void | |
$user->setEmail('[email protected]'); | ||
|
||
$manager->persist($user); | ||
$manager->flush(); | ||
|
||
$this->addReference('user', $user); | ||
|
||
$user = clone $this->getReference('user'); | ||
$user2 = new User(); | ||
$user2->setName('alice bar'); | ||
$user2->setEmail('[email protected]'); | ||
|
||
$manager->persist($user); | ||
$manager->persist($user2); | ||
$manager->flush(); | ||
} | ||
} |