Ojs\JournalBundle\Controller\IssueController::makeLastIssueAction PHP Метод

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

public makeLastIssueAction ( $id ) : RedirectResponse
$id
Результат Symfony\Component\HttpFoundation\RedirectResponse
    public function makeLastIssueAction($id)
    {
        $journal = $this->get('ojs.journal_service')->getSelectedJournal();
        if (!$this->isGranted('EDIT', $journal, 'issues')) {
            throw new AccessDeniedException("You are not authorized for this page");
        }
        $em = $this->getDoctrine()->getManager();
        $findSelectedIssue = $em->getRepository('OjsJournalBundle:Issue')->find($id);
        $this->throw404IfNotFound($findSelectedIssue);
        $findLastIssues = $em->getRepository('OjsJournalBundle:Issue')->findBy(['lastIssue' => true]);
        foreach ($findLastIssues as $issue) {
            $issue->setLastIssue(false);
        }
        $findSelectedIssue->setLastIssue(true);
        $em->flush();
        $this->successFlashBag('successfully.set.as.last.issue');
        return $this->redirectToRoute('ojs_journal_issue_index', ['journalId' => $journal->getId()]);
    }