Ojs\JournalBundle\Controller\ManagerPublisherThemeController::deleteAction PHP Метод

deleteAction() публичный Метод

public deleteAction ( Request $request, PublisherTheme $entity, integer $publisherId ) : RedirectResponse
$request Symfony\Component\HttpFoundation\Request
$entity Ojs\JournalBundle\Entity\PublisherTheme
$publisherId integer
Результат Symfony\Component\HttpFoundation\RedirectResponse
    public function deleteAction(Request $request, PublisherTheme $entity, $publisherId)
    {
        $em = $this->getDoctrine()->getManager();
        $publisher = $em->getRepository('OjsJournalBundle:Publisher')->find($publisherId);
        $this->throw404IfNotFound($publisher);
        if (!$this->isGrantedForPublisher($publisher)) {
            throw new AccessDeniedException("You are not authorized for this page!");
        }
        $this->throw404IfNotFound($entity);
        $em = $this->getDoctrine()->getManager();
        $csrf = $this->get('security.csrf.token_manager');
        $token = $csrf->getToken('ojs_publisher_manager_theme' . $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_publisher_manager_theme_index', ['publisherId' => $publisherId]);
    }