Newscoop\NewscoopBundle\Controller\BackendPublicationsController::createAction PHP Method

createAction() public method

public createAction ( Request $request )
$request Symfony\Component\HttpFoundation\Request
    public function createAction(Request $request)
    {
        $user = $this->container->get('user')->getCurrentUser();
        $translator = $this->container->get('translator');
        if (!$user->hasPermission('ManagePub')) {
            throw new AccessDeniedException($translator->trans("You do not have the right to add publications.", array(), 'pub'));
        }
        $form = $this->createForm(new PublicationType(), new Publication());
        if ($request->getMethod() === 'POST') {
            return $this->processRequest($request, $form);
        }
        return $this->render('NewscoopNewscoopBundle:BackendPublications:edit.html.twig', array('form' => $form->createView(), 'pageTitle' => $translator->trans('publications.title.add', array(), 'pub')));
    }