public function deleteAction(Request $request, $id)
{
$deleteService = $this->get('ojs_core.delete.service');
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('OjsJournalBundle:PersonTitle')->find($id);
$this->throw404IfNotFound($entity);
if (!$this->isGranted('DELETE', $entity)) {
throw new AccessDeniedException("You are not authorized for this page!");
}
$csrf = $this->get('security.csrf.token_manager');
$token = $csrf->getToken('ojs_admin_person_title' . $entity->getId());
if ($token != $request->get('_token')) {
throw new TokenNotFoundException("Token not found!");
}
$deleteService->check($entity);
$em->remove($entity);
$em->flush();
$this->successFlashBag('successful.remove');
return $this->redirectToRoute('ojs_admin_person_title_index');
}