public function updateAction(Request $request, Board $entity)
{
$journal = $this->get('ojs.journal_service')->getSelectedJournal();
$eventDispatcher = $this->get('event_dispatcher');
if (!$this->isGranted('EDIT', $journal, 'boards')) {
throw new AccessDeniedException("You not authorized for edit this journal's boards!");
}
$em = $this->getDoctrine()->getManager();
$editForm = $this->createEditForm($entity);
$editForm->handleRequest($request);
if ($editForm->isValid()) {
$event = new JournalItemEvent($entity);
$eventDispatcher->dispatch(BoardEvents::PRE_UPDATE, $event);
$em->persist($event->getItem());
$em->flush();
$event = new JournalItemEvent($event->getItem());
$eventDispatcher->dispatch(BoardEvents::POST_UPDATE, $event);
if ($event->getResponse()) {
return $event->getResponse();
}
$this->successFlashBag('successful.update');
return $this->redirectToRoute('ojs_journal_board_edit', ['id' => $entity->getId(), 'journalId' => $journal->getId()]);
}
return $this->render('OjsJournalBundle:Board:edit.html.twig', array('entity' => $entity, 'edit_form' => $editForm->createView()));
}