| Conditions | 2 | 
| Paths | 6 | 
| Total Lines | 14 | 
| Code Lines | 12 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 21 | public function truncateTable(EntityManagerInterface $em, string $className)  | 
            ||
| 22 |     { | 
            ||
| 23 | $classMetaData = $em->getClassMetadata($className);  | 
            ||
| 24 | $connection = $em->getConnection();  | 
            ||
| 25 | $dbPlatform = $connection->getDatabasePlatform();  | 
            ||
| 26 | $connection->beginTransaction();  | 
            ||
| 27 |         try { | 
            ||
| 28 |             $connection->query('SET FOREIGN_KEY_CHECKS=0'); | 
            ||
| 29 | $q = $dbPlatform->getTruncateTableSql($classMetaData->getTableName());  | 
            ||
| 30 | $connection->executeUpdate($q);  | 
            ||
| 31 |             $connection->query('SET FOREIGN_KEY_CHECKS=1'); | 
            ||
| 32 | $connection->commit();  | 
            ||
| 33 |         } catch (\Exception $e) { | 
            ||
| 34 | $connection->rollback();  | 
            ||
| 35 | }  | 
            ||
| 38 |