Change form fields value inside controller and then save it to db in Symfony : I am working on Symfony and i have got a problem.Which is as follows:-

***OrderAdminController:-***

    <?php
    namespace AppBundle\Controller;
    
    use Symfony\Component\HttpFoundation\Request;
    use Sonata\AdminBundle\Controller\CRUDController as Controller;
    use AppBundle\Entity\Order;
    use AppBundle\Entity\Month;
    
    class OrderAdminController extends Controller
    {
    
    //overriding Default CRUD create action
    	public function createAction()
        {
           
            $request = $this->getRequest();
             // this is the code where i am trying to change the coming values of ofrm fileds
             if(!empty($_POST)){
    			$key =array_keys($_POST)[0];
    			$date_to_floor = $_POST[$key]["date_to_floor"];
    			$user_id = $_POST[$key]["assigned"];
    			$hours_to_complete = $_POST[$key]["estimate"];
    			$final_data = $this->adjust_working_hours($date_to_floor,$user_id,$hours_to_complete);
    			$_POST[$key]["start_datetime"] = date('n/j/Y H:i',strtotime($final_data['start_date']));
    			$_POST[$key]["end_datetime"] = date('n/j/Y H:i',strtotime($final_data['end_date']));
    			$_POST[$key]["hours_remaining"] = $final_data['hours_remaining'];
    			$request->request->set('start_datetime', date('n/j/Y H:i',strtotime($final_data['start_date'])));
    			$request->request->set('end_datetime', date('n/j/Y H:i',strtotime($final_data['end_date'])));
    			$request->request->set('hours_remaining', $final_data['hours_remaining']);
    		}
            // the key used to lookup the template
            $templateKey = 'edit';
    		
            $this->admin->checkAccess('create');
    
            $class = new \ReflectionClass($this->admin->hasActiveSubClass() ? $this->admin->getActiveSubClass() : $this->admin->getClass());
    
            if ($class->isAbstract()) {
                return $this->render(
                    'SonataAdminBundle:CRUD:select_subclass.html.twig',
                    array(
                        'base_template' => $this->getBaseTemplate(),
                        'admin' => $this->admin,
                        'action' => 'create',
                    ),
                    null,
                    $request
                );
            }
    
            $object = $this->admin->getNewInstance();
    
            $preResponse = $this->preCreate($request, $object);
            if ($preResponse !== null) {
                return $preResponse;
            }
    
            $this->admin->setSubject($object);
    
            /** @var $form \Symfony\Component\Form\Form */
            $form = $this->admin->getForm();
            $form->setData($object);
            $form->handleRequest($request);
    
            if ($form->isSubmitted()) {
                //TODO: remove this check for 4.0
                if (method_exists($this->admin, 'preValidate')) {
                    $this->admin->preValidate($object);
                }
                $isFormValid = $form->isValid();
    
                // persist if the form was valid and if in preview mode the preview was approved
                if ($isFormValid && (!$this->isInPreviewMode($request) || $this->isPreviewApproved($request))) {
                    $this->admin->checkAccess('create', $object);
    
                    try {
                        $object = $this->admin->create($object);
    
                        if ($this->isXmlHttpRequest()) {
                            return $this->renderJson(array(
                                'result' => 'ok',
                                'objectId' => $this->admin->getNormalizedIdentifier($object),
                            ), 200, array());
                        }
    
                        $this->addFlash(
                            'sonata_flash_success',
                            $this->admin->trans(
                                'flash_create_success',
                                array('%name%' => $this->escapeHtml($this->admin->toString($object))),
                                'SonataAdminBundle'
                            )
                        );
    
                        // redirect to edit mode
                        return $this->redirectTo($object);
                    } catch (ModelManagerException $e) {
                        $this->handleModelManagerException($e);
    
                        $isFormValid = false;
                    }
                }
    
                // show an error message if the form failed validation
                if (!$isFormValid) {
                    if (!$this->isXmlHttpRequest()) {
                        $this->addFlash(
                            'sonata_flash_error',
                            $this->admin->trans(
                                'flash_create_error',
                                array('%name%' => $this->escapeHtml($this->admin->toString($object))),
                                'SonataAdminBundle'
                            )
                        );
                    }
                } elseif ($this->isPreviewRequested()) {
                    // pick the preview template if the form was valid and preview was requested
                    $templateKey = 'preview';
                    $this->admin->getShow();
                }
            }
    
            $view = $form->createView();
    
            // set the theme for the current Admin Form
            $this->get('twig')->getExtension('form')->renderer->setTheme($view, $this->admin->getFormTheme());
    
            return $this->render($this->admin->getTemplate($templateKey), array(
                'action' => 'create',
                'form' => $view,
                'object' => $object,
            ), null);
        }
    }

***Now what i am trying is when form submitted, i need to change some form field values based on `adjust_working_hours()`.***

***The problem is :-***

***if i added this code:-*** 

     if(!empty($_POST)){
    		$key =array_keys($_POST)[0];
    		$date_to_floor = $_POST[$key]["date_to_floor"];
    		$user_id = $_POST[$key]["assigned"];
    		$hours_to_complete = $_POST[$key]["estimate"];
    		$final_data = $this->adjust_working_hours($date_to_floor,$user_id,$hours_to_complete);
    		$_POST[$key]["start_datetime"] = date('n/j/Y H:i',strtotime($final_data['start_date']));
    		$_POST[$key]["end_datetime"] = date('n/j/Y H:i',strtotime($final_data['end_date']));
    		$_POST[$key]["hours_remaining"] = $final_data['hours_remaining'];
    		$request->request->set('start_datetime', date('n/j/Y H:i',strtotime($final_data['start_date'])));
    		$request->request->set('end_datetime', date('n/j/Y H:i',strtotime($final_data['end_date'])));
    		$request->request->set('hours_remaining', $final_data['hours_remaining']);
    	}
	
***Before:- `if ($form->isSubmitted()) {`***  

***the original form values are saved into db not the changed one.***



***And if i add the same code after `if ($form->isSubmitted()) {`***  

***then it says error :-*** 

> You cannot changes the data of submitted form

So how to change those field values so that my changed values will save?

Let me know if any other details needed.

