public function createAction($publisherId, Request $request)
{
$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!");
}
$entity = new PublisherTheme();
$form = $this->createCreateForm($entity, $publisher);
$form->handleRequest($request);
if ($form->isValid()) {
$em = $this->getDoctrine()->getManager();
$entity->setPublisher($publisher);
$em->persist($entity);
$em->flush();
$this->successFlashBag('successful.create');
return $this->redirectToRoute('ojs_publisher_manager_theme_show', ['publisherId' => $publisher->getId(), 'id' => $entity->getId()]);
}
return $this->render('OjsJournalBundle:ManagerPublisherTheme:new.html.twig', array('entity' => $entity, 'publisher' => $publisher, 'form' => $form->createView()));
}