public function handleForm($formClass, $object = null, Request $request, array $formOptions = [])
    {
        $form = $this->createForm($formClass, $object, $formOptions);
        if ($request->isMethod('POST') || $request->isMethod('PUT') || $request->isMethod('PATCH')) {
            $form->handleRequest($request);
            if (!$form->isValid()) {
                return $form;
            }

            if (!$object) {
                $object = $form->getData();
            }

            $this->handleFiles($request->files, $object);
            $this->handleObject($object);
        }

        return $form;
    }
public function handleForm($formClass, $object = null, Request $request, array $formOptions = [])
    {
        $form = $this->createForm($formClass, $object, $formOptions);
        if ($request->isMethod('POST') || $request->isMethod('PUT') || $request->isMethod('PATCH')) {
            $form->handleRequest($request);
            if (!$form->isValid()) {
                return $form;
            }

            if (!$object) {
                $object = $form->getData();
            }

            $this->handleFiles($request->files, $object);
            $this->handleObject($object);
        }

        return $form;
    }
public function handleForm ( $ formClass , $ object = null , Request $ request , array $ formOptions = [ ] ) { $ form = $ this -> createForm ( $ formClass , $ object , $ formOptions ) ; if ( $ request -> isMethod ( 'POST' ) || $ request -> isMethod ( 'PUT' ) || $ request -> isMethod ( 'PATCH' ) ) { $ form -> handleRequest ( $ request ) ; if ( ! $ form -> isValid ( ) ) { return $ form ; } if ( ! $ object ) { $ object = $ form -> getData ( ) ; } $ this -> handleFiles ( $ request -> files , $ object ) ; $ this -> handleObject ( $ object ) ; } return $ form ; }
Handles the form and saves the object to the DB. All process can be changed extending
handleFiles and handleObject methods. See each methods doc for more info.

@param string      $formClass   The FQCN of form type
@param object|null $object      The object to be edited with form content
@param Request     $request     Contains values sent by the user
@param array       $formOptions Array which contains the options that will be passed in the form create method

@throws InvalidFormException    when the form is invalid
@throws InvalidOptionsException when the given options are invalid

@return FormInterface
Handles the form and saves the object to the DB . All process can be changed extending handleFiles and handleObject methods . See each methods doc for more info .