92
* @return RedirectResponse|Response
* @Config\Route("/deparments/add", name =
"site_deparments_add")
*/
public function deparmentaddAction()
{
$deparment = new Deparment();
$form = $this->createForm(new DeparmentFormType(),
$deparment);
$form->handleRequest($this->request);
if ($form->isSubmitted() && $form->isValid()) {
$this->manager->persist($deparment);
$this->manager->flush();
$this->addNotice('success',
'sprav.html.twig',
array('notice' => 'deparment_added',
'caption' => $deparment->getCaption())
);
return $this-
>redirectToRoute('site_deparments_index');
}
$this->forms['deparment'] = $form->createView();
$this->view['deparment'] = null;
$this->navigation = array('active' => 'sprav');
return $this-
>render('AppBundle:Sprav:deparment.html.twig');
}
/**
* @param Deparment $deparment
* @return RedirectResponse|Response
* @Config\Route("/deparments/{deparment}/edit", name =
"site_deparments_edit")
* @Config\ParamConverter("deparment", options =
{"mapping": {"deparment": "id"}})
*/
public function deparmenteditAction(Deparment $deparment)
{
$form = $this->createForm(new DeparmentFormType(),
$deparment);
$form->handleRequest($this->request);
if ($form->isSubmitted() && $form->isValid()) {
$this->manager->persist($deparment);
$this->manager->flush();
$this->addNotice('success',
'sprav.html.twig',
array('notice' => 'deparment_changed',
'caption' => $deparment->getCaption())
);
return $this-
>redirectToRoute('site_deparments_index');
}