diff --git a/src/Bridge/Doctrine/Purger/Purger.php b/src/Bridge/Doctrine/Purger/Purger.php index 0eee442..15c6e3c 100644 --- a/src/Bridge/Doctrine/Purger/Purger.php +++ b/src/Bridge/Doctrine/Purger/Purger.php @@ -17,6 +17,7 @@ use Doctrine\Common\DataFixtures\Purger\ORMPurger as DoctrineOrmPurger; use Doctrine\Common\DataFixtures\Purger\PHPCRPurger as DoctrinePhpCrPurger; use Doctrine\Common\DataFixtures\Purger\PurgerInterface as DoctrinePurgerInterface; +use Doctrine\DBAL\Platforms\MariaDBPlatform; use Doctrine\DBAL\Platforms\MySqlPlatform; use Doctrine\ODM\MongoDB\DocumentManager as DoctrineMongoDocumentManager; use Doctrine\ODM\PHPCR\DocumentManager as DoctrinePhpCrDocumentManager; @@ -93,7 +94,7 @@ public function purge(): void $disableFkChecks = ( $this->purger instanceof DoctrineOrmPurger && in_array($this->purgeMode->getValue(), [PurgeMode::createDeleteMode()->getValue(), PurgeMode::createTruncateMode()->getValue()]) - && $this->purger->getObjectManager()->getConnection()->getDatabasePlatform() instanceof MySqlPlatform + && $this->doesDatabaseSupportTruncate() ); if ($disableFkChecks) { @@ -136,4 +137,12 @@ private static function createPurger(ObjectManager $manager, ?PurgeMode $purgeMo ) ); } + + private function doesDatabaseSupportTruncate(): bool + { + $platform = $this->purger->getObjectManager()->getConnection()->getDatabasePlatform(); + + return $platform instanceof MySqlPlatform + || $platform instanceof MariaDBPlatform; + } }