Controller/Backend/LanguageController.php
public function updateAction(Request $request, $id)
    {
        $breadcumbs = $this->container->get('bacon_breadcrumbs');

        $breadcumbs->addItem(array(
            'title' => 'Language',
            'route' => 'admin_language',
        ));

        $breadcumbs->addItem(array(
            'title' => 'Edit',
            'route' => '',
        ));

        $entity = $this->getDoctrine()->getRepository('BaconLanguageBundle:Language')->find($id);

        if (!$entity) {

            $this->get('session')->getFlashBag()->add('message', array(
                'type' => 'error',
                'message' => 'Registry not Found',
            ));

            return $this->redirect($this->generateUrl('admin_language'));
        }

        $form = $this->createForm(new LanguageFormType(), $entity);
        $deleteForm = $this->createDeleteForm($id);

        $handler = new LanguageFormHandler(
            $form,
            $request,
            $this->getDoctrine()->getManager(),
            $this->get('session')->getFlashBag()
        );

        if ($handler->save()) {
            return $this->redirect($this->generateUrl('admin_language'));
        }

        return array(
            'entity'      => $entity,
            'form'        => $form->createView(),
            'delete_form' => $deleteForm->createView(),
        );
    }
public function updateAction(Request $request, $id)
    {
        $breadcumbs = $this->container->get('bacon_breadcrumbs');

        $breadcumbs->addItem(array(
            'title' => 'Language',
            'route' => 'admin_language',
        ));

        $breadcumbs->addItem(array(
            'title' => 'Edit',
            'route' => '',
        ));

        $entity = $this->getDoctrine()->getRepository('BaconLanguageBundle:Language')->find($id);

        if (!$entity) {

            $this->get('session')->getFlashBag()->add('message', array(
                'type' => 'error',
                'message' => 'Registry not Found',
            ));

            return $this->redirect($this->generateUrl('admin_language'));
        }

        $form = $this->createForm(new LanguageFormType(), $entity);
        $deleteForm = $this->createDeleteForm($id);

        $handler = new LanguageFormHandler(
            $form,
            $request,
            $this->getDoctrine()->getManager(),
            $this->get('session')->getFlashBag()
        );

        if ($handler->save()) {
            return $this->redirect($this->generateUrl('admin_language'));
        }

        return array(
            'entity'      => $entity,
            'form'        => $form->createView(),
            'delete_form' => $deleteForm->createView(),
        );
    }
public function updateAction ( Request $ request , $ id ) { $ breadcumbs = $ this -> container -> get ( 'bacon_breadcrumbs' ) ; $ breadcumbs -> addItem ( array ( 'title' => 'Language' , 'route' => 'admin_language' , ) ) ; $ breadcumbs -> addItem ( array ( 'title' => 'Edit' , 'route' => '' , ) ) ; $ entity = $ this -> getDoctrine ( ) -> getRepository ( 'BaconLanguageBundle:Language' ) -> find ( $ id ) ; if ( ! $ entity ) { $ this -> get ( 'session' ) -> getFlashBag ( ) -> add ( 'message' , array ( 'type' => 'error' , 'message' => 'Registry not Found' , ) ) ; return $ this -> redirect ( $ this -> generateUrl ( 'admin_language' ) ) ; } $ form = $ this -> createForm ( new LanguageFormType ( ) , $ entity ) ; $ deleteForm = $ this -> createDeleteForm ( $ id ) ; $ handler = new LanguageFormHandler ( $ form , $ request , $ this -> getDoctrine ( ) -> getManager ( ) , $ this -> get ( 'session' ) -> getFlashBag ( ) ) ; if ( $ handler -> save ( ) ) { return $ this -> redirect ( $ this -> generateUrl ( 'admin_language' ) ) ; } return array ( 'entity' => $ entity , 'form' => $ form -> createView ( ) , 'delete_form' => $ deleteForm -> createView ( ) , ) ; }
Edits an existing Language entity.

@Route("/{id}", name="admin_language_update")
@Method("PUT")
@Security("has_role('ROLE_ADMIN')")
@Template("BaconLanguageBundle:Backend/Language:edit.html.twig")
Edits an existing Language entity .