From 05b1965957c651c6a8b57d1648a983e96547b305 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 5 Apr 2026 23:45:09 +0200 Subject: [PATCH] Use truncatate purging during load fixtures to fix compatibility for postgres --- src/Command/LoadFixturesCommand.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Command/LoadFixturesCommand.php b/src/Command/LoadFixturesCommand.php index d01d19c3..98052ba6 100644 --- a/src/Command/LoadFixturesCommand.php +++ b/src/Command/LoadFixturesCommand.php @@ -56,13 +56,16 @@ class LoadFixturesCommand extends Command } $factory = new ResetAutoIncrementPurgerFactory(); - $purger = $factory->createForEntityManager(null, $this->entityManager); + + //Use truncate purging to fix compatibility with postgresql + $purger = $factory->createForEntityManager(null, $this->entityManager, purgeWithTruncate: true); $purger->purge(); //Afterwards run the load fixtures command as normal, but with the --append option $new_input = new ArrayInput([ 'command' => 'doctrine:fixtures:load', + '--purge-with-truncate' => true, '--append' => true, ]); @@ -70,4 +73,4 @@ class LoadFixturesCommand extends Command return $returnCode ?? Command::FAILURE; } -} \ No newline at end of file +}