Controller/SeriesController.php
public function editAction(Request $request, $series)
    {
        $series = $this->get('oktolab_media')->getSeries($series);
        $form = $this->createForm(SeriesType::class, $series);
        $form->add('submit', SubmitType::class, ['label' => 'oktolab_media.edit_series_button', 'attr' => ['class' => 'btn btn-primary']]);
        $form->add('delete', SubmitType::class, ['label' => 'oktolab_media.delete_series_button', 'attr' => ['class' => 'btn btn-danger']]);

        if ($request->getMethod() == "POST") { //sends form
            $form->handleRequest($request);
            $em = $this->getDoctrine()->getManager();
            if ($form->isValid() || $form->get('delete')->isClicked()) { //form is valid, save or preview
                if ($form->get('submit')->isClicked()) { //save me
                    $em->persist($series);
                    $em->flush();
                    $this->get('session')->getFlashBag()->add('success', 'oktolab_media.success_edit_series');
                    return $this->redirect($this->generateUrl('oktolab_series_show', ['series' => $series->getUniqID()]));
                } elseif ($form->get('delete')->isClicked()) {
                    $this->get('oktolab_media_helper')->deleteSeries($series);
                    $this->get('session')->getFlashBag()->add('success', 'oktolab_media.success_delete_series');
                    return $this->redirect($this->generateUrl('oktolab_series'));
                } else { //???
                    $this->get('session')->getFlashBag()->add('success', 'oktolab_media.unknown_action_series');
                    return $this->redirect($this->generateUrl('oktolab_series_show', ['series' => $series->getUniqID()]));
                }
            }
            $this->get('session')->getFlashBag()->add('error', 'oktolab_media.error_edit_series');
        }

        return ['form' => $form->createView()];
    }
public function editAction(Request $request, $series)
    {
        $series = $this->get('oktolab_media')->getSeries($series);
        $form = $this->createForm(SeriesType::class, $series);
        $form->add('submit', SubmitType::class, ['label' => 'oktolab_media.edit_series_button', 'attr' => ['class' => 'btn btn-primary']]);
        $form->add('delete', SubmitType::class, ['label' => 'oktolab_media.delete_series_button', 'attr' => ['class' => 'btn btn-danger']]);

        if ($request->getMethod() == "POST") { //sends form
            $form->handleRequest($request);
            $em = $this->getDoctrine()->getManager();
            if ($form->isValid() || $form->get('delete')->isClicked()) { //form is valid, save or preview
                if ($form->get('submit')->isClicked()) { //save me
                    $em->persist($series);
                    $em->flush();
                    $this->get('session')->getFlashBag()->add('success', 'oktolab_media.success_edit_series');
                    return $this->redirect($this->generateUrl('oktolab_series_show', ['series' => $series->getUniqID()]));
                } elseif ($form->get('delete')->isClicked()) {
                    $this->get('oktolab_media_helper')->deleteSeries($series);
                    $this->get('session')->getFlashBag()->add('success', 'oktolab_media.success_delete_series');
                    return $this->redirect($this->generateUrl('oktolab_series'));
                } else { //???
                    $this->get('session')->getFlashBag()->add('success', 'oktolab_media.unknown_action_series');
                    return $this->redirect($this->generateUrl('oktolab_series_show', ['series' => $series->getUniqID()]));
                }
            }
            $this->get('session')->getFlashBag()->add('error', 'oktolab_media.error_edit_series');
        }

        return ['form' => $form->createView()];
    }
public function editAction ( Request $ request , $ series ) { $ series = $ this -> get ( 'oktolab_media' ) -> getSeries ( $ series ) ; $ form = $ this -> createForm ( SeriesType :: class , $ series ) ; $ form -> add ( 'submit' , SubmitType :: class , [ 'label' => 'oktolab_media.edit_series_button' , 'attr' => [ 'class' => 'btn btn-primary' ] ] ) ; $ form -> add ( 'delete' , SubmitType :: class , [ 'label' => 'oktolab_media.delete_series_button' , 'attr' => [ 'class' => 'btn btn-danger' ] ] ) ; if ( $ request -> getMethod ( ) == "POST" ) { //sends form $ form -> handleRequest ( $ request ) ; $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; if ( $ form -> isValid ( ) || $ form -> get ( 'delete' ) -> isClicked ( ) ) { //form is valid, save or preview if ( $ form -> get ( 'submit' ) -> isClicked ( ) ) { //save me $ em -> persist ( $ series ) ; $ em -> flush ( ) ; $ this -> get ( 'session' ) -> getFlashBag ( ) -> add ( 'success' , 'oktolab_media.success_edit_series' ) ; return $ this -> redirect ( $ this -> generateUrl ( 'oktolab_series_show' , [ 'series' => $ series -> getUniqID ( ) ] ) ) ; } elseif ( $ form -> get ( 'delete' ) -> isClicked ( ) ) { $ this -> get ( 'oktolab_media_helper' ) -> deleteSeries ( $ series ) ; $ this -> get ( 'session' ) -> getFlashBag ( ) -> add ( 'success' , 'oktolab_media.success_delete_series' ) ; return $ this -> redirect ( $ this -> generateUrl ( 'oktolab_series' ) ) ; } else { //??? $ this -> get ( 'session' ) -> getFlashBag ( ) -> add ( 'success' , 'oktolab_media.unknown_action_series' ) ; return $ this -> redirect ( $ this -> generateUrl ( 'oktolab_series_show' , [ 'series' => $ series -> getUniqID ( ) ] ) ) ; } } $ this -> get ( 'session' ) -> getFlashBag ( ) -> add ( 'error' , 'oktolab_media.error_edit_series' ) ; } return [ 'form' => $ form -> createView ( ) ] ; }
Displays a form to edit an existing Series entity.

@ ParamConverter("series", class="OktolabMediaBundle:Series")
@Method({"GET", "POST"})
@Template()
Displays a form to edit an existing Series entity .