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

deleteAction() public method

public deleteAction ( Request $request, PublisherTypes $entity ) : RedirectResponse
$request Symfony\Component\HttpFoundation\Request
$entity Ojs\JournalBundle\Entity\PublisherTypes
return Symfony\Component\HttpFoundation\RedirectResponse
    public function deleteAction(Request $request, PublisherTypes $entity)
    {
        $this->throw404IfNotFound($entity);
        $em = $this->getDoctrine()->getManager();
        $csrf = $this->get('security.csrf.token_manager');
        $token = $csrf->getToken('ojs_admin_publisher_type' . $entity->getId());
        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->redirectToRoute('ojs_admin_publisher_type_index');
    }