Symfony Commands for Loading and Purging Fixtures
Doctrine already has a command to load fixtures, symfony console doctrine:fixtures:load , but does not take into account the reset of sequences and there is no command just to purge fixtures. The article describes Symfony commands: Purge Database, Restart Sequences (PostgreSQL) and Load Fixtures Purge Database Without Loading Fixtures Purge Database, Restart Sequences (PostgreSQL) and Load Fixtures // src/Command/LoadFixturesCommand.php <?php namespace App\Command; use Doctrine\DBAL\Exception; use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Exception\ExceptionInterface; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; #[AsCommand( name: 'app:fixtures:load', description: 'Purg...