public function delete($id) { $filter = $this->filterRepository->findById($id); if (!$filter) { throw new FilterNotFoundException($id); } $this->em->remove($filter); $this->em->flush(); }