src/Sedona/SBORuntimeBundle/Controller/BaseCrudController.php
protected function manageEdit($entity, Request $request, $formTypeFQCN)
    {
        $form = $this->createForm($formTypeFQCN, $entity, array(
            'action' => $this->getEditUrl($entity),
            'method' => 'POST',
        ));

        $form
            ->add('save', SubmitType::class, array('attr' => array('class' => 'btn btn-primary')))
            ->add('delete', SubmitType::class, array('attr' => array('class' => 'btn btn-danger')));

        $form->handleRequest($request);

        if ($form->isSubmitted()) {
            if ($form->get('save')->isClicked()) {
                if ($form->isValid()) {
                    return $this->crudManage($entity, AdminCrudEvent::UPDATE);
                }
            } elseif ($form->get('delete')->isClicked()) {
                return $this->crudManage($entity, AdminCrudEvent::DELETE);
            }
        }

        return $this->render(
            $this->getEditTemplate(),
            array(
                'entity' => $entity,
                'form' => $form->createView(),
            ));
    }
protected function manageEdit($entity, Request $request, $formTypeFQCN)
    {
        $form = $this->createForm($formTypeFQCN, $entity, array(
            'action' => $this->getEditUrl($entity),
            'method' => 'POST',
        ));

        $form
            ->add('save', SubmitType::class, array('attr' => array('class' => 'btn btn-primary')))
            ->add('delete', SubmitType::class, array('attr' => array('class' => 'btn btn-danger')));

        $form->handleRequest($request);

        if ($form->isSubmitted()) {
            if ($form->get('save')->isClicked()) {
                if ($form->isValid()) {
                    return $this->crudManage($entity, AdminCrudEvent::UPDATE);
                }
            } elseif ($form->get('delete')->isClicked()) {
                return $this->crudManage($entity, AdminCrudEvent::DELETE);
            }
        }

        return $this->render(
            $this->getEditTemplate(),
            array(
                'entity' => $entity,
                'form' => $form->createView(),
            ));
    }
protected function manageEdit ( $ entity , Request $ request , $ formTypeFQCN ) { $ form = $ this -> createForm ( $ formTypeFQCN , $ entity , array ( 'action' => $ this -> getEditUrl ( $ entity ) , 'method' => 'POST' , ) ) ; $ form -> add ( 'save' , SubmitType :: class , array ( 'attr' => array ( 'class' => 'btn btn-primary' ) ) ) -> add ( 'delete' , SubmitType :: class , array ( 'attr' => array ( 'class' => 'btn btn-danger' ) ) ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isSubmitted ( ) ) { if ( $ form -> get ( 'save' ) -> isClicked ( ) ) { if ( $ form -> isValid ( ) ) { return $ this -> crudManage ( $ entity , AdminCrudEvent :: UPDATE ) ; } } elseif ( $ form -> get ( 'delete' ) -> isClicked ( ) ) { return $ this -> crudManage ( $ entity , AdminCrudEvent :: DELETE ) ; } } return $ this -> render ( $ this -> getEditTemplate ( ) , array ( 'entity' => $ entity , 'form' => $ form -> createView ( ) , ) ) ; }
Generic edit controller helper.

@param $entity
@param Request $request

@return string|\Symfony\Component\HttpFoundation\RedirectResponse
Generic edit controller helper .