public function publisherAction(Request $request)
{
/** @var $dispatcher EventDispatcherInterface */
$dispatcher = $this->get('event_dispatcher');
if (!$request->attributes->get('_system_setting')->isPublisherApplicationActive()) {
return $this->render('OjsSiteBundle:Site:not_available.html.twig', ['title' => 'title.journal_application', 'message' => 'message.application_not_available']);
}
$em = $this->getDoctrine()->getManager();
$application = new Publisher();
$form = $this->createForm(new PublisherApplicationType(), $application);
if ($request->isMethod('POST')) {
$form->handleRequest($request);
if ($form->isValid()) {
$em->persist($application);
$em->flush();
$event = new AdminEvent(['entity' => $application]);
$dispatcher->dispatch(AdminEvents::PUBLISHER_APPLICATION_HAPPEN, $event);
return $this->redirectToRoute('ojs_apply_institute_success');
}
$this->errorFlashBag('An error has occured. Please check form and resubmit.');
}
return $this->render('OjsSiteBundle:Application:publisher.html.twig', array('form' => $form->createView()));
}