Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- */
- public function truncateDatabase()
- {
- $conn = $this->container->entityManager->getConnection();
- $conn->beginTransaction();
- try {
- foreach ($conn->getSchemaManager()->listTableNames() as $tableName) {
- $query = $conn->getDatabasePlatform()->getTruncateTableSql($tableName);
- $conn->executeUpdate($query);
- }
- $conn->commit();
- } catch (\Exception $e) {
- throw $e;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment