Skip to content

Commit

Permalink
chore: persist and flush fixtures only once, and remove call to clone
Browse files Browse the repository at this point in the history
  • Loading branch information
alexislefebvre committed Jul 3, 2024
1 parent 437e674 commit 68db9c6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
1 change: 0 additions & 1 deletion tests/App/DataFixtures/ORM/LoadUserData.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public function load(ObjectManager $manager): void
$user->setEmail('[email protected]');

$manager->persist($user);
$manager->flush();

$this->addReference('user', $user);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

0 comments on commit 68db9c6

Please sign in to comment.