protected function removeAll() { /** @var EntityManager $em */ $em = $this->doctrine->getManager(); foreach ($this->doctrine->getRepository('NetNexusTimesheetBundle:Workitem')->findAll() as $wi) { $em->remove($wi); } $em->flush(); }