Newscoop\NewscoopBundle\Controller\BackendPublicationsController::editAction PHP Метод

editAction() публичный Метод

public editAction ( Request $request, Publication $publication )
$request Symfony\Component\HttpFoundation\Request
$publication Newscoop\Entity\Publication
    public function editAction(Request $request, Publication $publication)
    {
        $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 change publication information.", array(), 'pub'));
        }
        $form = $this->createForm(new PublicationType(), $publication, array('publication_id' => $publication->getId()));
        if ($request->getMethod() === 'POST') {
            $form = $this->processRequest($request, $form, $publication);
            if ($form instanceof RedirectResponse) {
                return $form;
            }
        }
        return $this->render('NewscoopNewscoopBundle:BackendPublications:edit.html.twig', array('form' => $form->createView(), 'pageTitle' => $translator->trans('publications.title.edit', array(), 'pub')));
    }