Ojs\AdminBundle\Controller\AdminInstitutionController::deleteAction PHP Method

deleteAction() public method

public deleteAction ( Request $request, $id ) : RedirectResponse
$request Symfony\Component\HttpFoundation\Request
$id
return Symfony\Component\HttpFoundation\RedirectResponse
    public function deleteAction(Request $request, $id)
    {
        $em = $this->getDoctrine()->getManager();
        $entity = $em->getRepository('OjsJournalBundle:Institution')->find($id);
        $this->throw404IfNotFound($entity);
        $csrf = $this->get('security.csrf.token_manager');
        $token = $csrf->getToken('ojs_admin_institution' . $id);
        if ($token != $request->get('_token')) {
            throw new TokenNotFoundException("Token Not Found!");
        }
        $this->get('ojs_core.delete.service')->check($entity);
        $em->remove($entity);
        $em->flush();
        $this->successFlashBag('successful.remove');
        return $this->redirect($this->generateUrl('ojs_admin_institution_index'));
    }