src/TrivialSense/FrameworkCommon/Controller/AbstractController.php
public function createAndSubmitForm($type, $data = null, callable $validCallback = null)
    {
        $form = $this->createForm($type, $data);

        if ($this->isPost()) {
            $form->handleRequest($this->getRequest());

            if ($form->isValid()) {
                if ($validCallback) {
                    $response = $validCallback($form->getData(), $form);

                    if($response instanceof Response)

                        return $response;
                }
            }
        }

        return $form->createView();
    }
public function createAndSubmitForm($type, $data = null, callable $validCallback = null)
    {
        $form = $this->createForm($type, $data);

        if ($this->isPost()) {
            $form->handleRequest($this->getRequest());

            if ($form->isValid()) {
                if ($validCallback) {
                    $response = $validCallback($form->getData(), $form);

                    if($response instanceof Response)

                        return $response;
                }
            }
        }

        return $form->createView();
    }
public function createAndSubmitForm ( $ type , $ data = null , callable $ validCallback = null ) { $ form = $ this -> createForm ( $ type , $ data ) ; if ( $ this -> isPost ( ) ) { $ form -> handleRequest ( $ this -> getRequest ( ) ) ; if ( $ form -> isValid ( ) ) { if ( $ validCallback ) { $ response = $ validCallback ( $ form -> getData ( ) , $ form ) ; if ( $ response instanceof Response ) return $ response ; } } } return $ form -> createView ( ) ; }
Creates a submit a form, to use in controllers

@param $type
@param object|array $data
@param callable     $validCallback Callback to call when form is valid

@return \Symfony\Component\Form\FormView
Creates a submit a form to use in controllers