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