public function createAction(Request $request)
{
$em = $this->getDoctrine()->getManager();
$journal = $this->get('ojs.journal_service')->getSelectedJournal();
if (!$this->isGranted('CREATE', $journal, 'block')) {
throw new AccessDeniedException("You not authorized for this page!");
}
$entity = new Block();
$form = $this->createCreateForm($entity, $journal);
$form->handleRequest($request);
if ($form->isValid()) {
$entity->setJournal($journal);
$em->persist($entity);
$em->flush();
$this->successFlashBag('successful.create');
return $this->redirectToRoute('ojs_journal_block_show', ['id' => $entity->getId(), 'journalId' => $journal->getId()]);
}
return $this->render('OjsJournalBundle:Block:new.html.twig', array('entity' => $entity, 'form' => $form->createView()));
}