Skip to content

Instantly share code, notes, and snippets.

View wassimbkd's full-sized avatar

wassim Boukadida wassimbkd

View GitHub Profile
@wassimbkd
wassimbkd / PurgeDoctrineDatabaseCommand.php
Created August 21, 2023 09:55
This command is part of a Symfony application. The purpose is to interact with the Doctrine ORM to perform database purging. (without using fixtures)
<?php
namespace App\Command;
use Doctrine\Bundle\FixturesBundle\Purger\ORMPurgerFactory;
use Doctrine\Common\DataFixtures\Executor\ORMExecutor;
use Doctrine\DBAL\Exception;
use Doctrine\Migrations\Tools\Console\Command\DoctrineCommand;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Console\Attribute\AsCommand;