Thanks! Great hacky solution! But for the moment of December 2019 it's not working. Seems that doctrine changed the way how they detect platform. So few steps for Symfony version 4 to make it working again!
1) remove platform in .env.test, e.g. it was:
DATABASETESTURL=mysql://user:pass@host:3306/testdb
must be:
DATABASETESTURL=//user:pass@host:3306/testdb
2) you need to override different method inside custom "Driver" class, in article it's "getDatabasePlatform" but it must be "createDatabasePlatformForVersion" from the interface "VersionAwarePlatformDriver"
3) and last but not least, for overridden "Platform" method body should be next (from parent class)
$tableIdentifier = new Identifier($tableName);
return sprintf(
'SET foreignkeychecks = 0;TRUNCATE %s;SET foreignkeychecks = 1;',
$tableIdentifier->getQuotedName($this)
);
Thanks! Great hacky solution! But for the moment of December 2019 it's not working. Seems that doctrine changed the way how they detect platform. So few steps for Symfony version 4 to make it working again!
1) remove platform in .env.test, e.g. it was:
DATABASETESTURL=mysql://user:pass@host:3306/testdb
must be:
DATABASETESTURL=//user:pass@host:3306/testdb
2) you need to override different method inside custom "Driver" class, in article it's "getDatabasePlatform" but it must be "createDatabasePlatformForVersion" from the interface "VersionAwarePlatformDriver"
3) and last but not least, for overridden "Platform" method body should be next (from parent class)
$tableIdentifier = new Identifier($tableName);
return sprintf(
'SET foreignkeychecks = 0;TRUNCATE %s;SET foreignkeychecks = 1;',
$tableIdentifier->getQuotedName($this)
);