I assume that I need to build a native query to truncate a table using Doctine2.
$emptyRsm = new \\Doctrine\\ORM\\Query\\ResultSetMapping();
$sql = \'TRUNCAT
This is how you can delete all entites from a entity reposiotry in symfony using doctrine (not ignoring foreign key checks). The functions returns the count of the deleted entites.
/**
* @return int
*/
public function deleteAll(): int
{
$qb = $this->createQueryBuilder('t');
$qb->delete();
return $qb->getQuery()->getSingleScalarResult() ?? 0;
}