Controller/ExportController.php
protected function exportFormStep(Request $request, $alias)
    {
        $exportManager = $this->get('chill.main.export_manager');
        
        // check we have data from the previous step (export step)
        $data = $this->get('session')->get('centers_step', null);
        
        if ($data === null) {
            
            return $this->redirectToRoute('chill_main_export_new', array(
               'step' => $this->getNextStep('export', true),
               'alias' => $alias
               ));
        }
        
        $export = $exportManager->getExport($alias);
                
        $form = $this->createCreateFormExport($alias, 'export', $data);
        
        if ($request->getMethod() === 'POST') {
            $form->handleRequest($request);
            if ($form->isValid()) {
                
                $this->get('logger')->debug('form export is valid', array(
                      'location' => __METHOD__));
                
                // store data for reusing in next steps
                $data = $form->getData();
                $this->get('session')->set('export_step_raw', 
                      $request->request->all());
                $this->get('session')->set('export_step', $data);
                
                //redirect to next step
                return $this->redirect(
                      $this->generateUrl('chill_main_export_new', array(
                         'step' => $this->getNextStep('export'),
                         'alias' => $alias
                      )));
            } else {
                $this->get('logger')->debug('form export is invalid', array(
                      'location' => __METHOD__));
            }
        }
        
        return $this->render('ChillMainBundle:Export:new.html.twig', array(
            'form' => $form->createView(),
            'export_alias' => $alias,
            'export' => $export
        ));
    }
protected function exportFormStep(Request $request, $alias)
    {
        $exportManager = $this->get('chill.main.export_manager');
        
        // check we have data from the previous step (export step)
        $data = $this->get('session')->get('centers_step', null);
        
        if ($data === null) {
            
            return $this->redirectToRoute('chill_main_export_new', array(
               'step' => $this->getNextStep('export', true),
               'alias' => $alias
               ));
        }
        
        $export = $exportManager->getExport($alias);
                
        $form = $this->createCreateFormExport($alias, 'export', $data);
        
        if ($request->getMethod() === 'POST') {
            $form->handleRequest($request);
            if ($form->isValid()) {
                
                $this->get('logger')->debug('form export is valid', array(
                      'location' => __METHOD__));
                
                // store data for reusing in next steps
                $data = $form->getData();
                $this->get('session')->set('export_step_raw', 
                      $request->request->all());
                $this->get('session')->set('export_step', $data);
                
                //redirect to next step
                return $this->redirect(
                      $this->generateUrl('chill_main_export_new', array(
                         'step' => $this->getNextStep('export'),
                         'alias' => $alias
                      )));
            } else {
                $this->get('logger')->debug('form export is invalid', array(
                      'location' => __METHOD__));
            }
        }
        
        return $this->render('ChillMainBundle:Export:new.html.twig', array(
            'form' => $form->createView(),
            'export_alias' => $alias,
            'export' => $export
        ));
    }
protected function exportFormStep ( Request $ request , $ alias ) { $ exportManager = $ this -> get ( 'chill.main.export_manager' ) ; // check we have data from the previous step (export step) $ data = $ this -> get ( 'session' ) -> get ( 'centers_step' , null ) ; if ( $ data === null ) { return $ this -> redirectToRoute ( 'chill_main_export_new' , array ( 'step' => $ this -> getNextStep ( 'export' , true ) , 'alias' => $ alias ) ) ; } $ export = $ exportManager -> getExport ( $ alias ) ; $ form = $ this -> createCreateFormExport ( $ alias , 'export' , $ data ) ; if ( $ request -> getMethod ( ) === 'POST' ) { $ form -> handleRequest ( $ request ) ; if ( $ form -> isValid ( ) ) { $ this -> get ( 'logger' ) -> debug ( 'form export is valid' , array ( 'location' => __METHOD__ ) ) ; // store data for reusing in next steps $ data = $ form -> getData ( ) ; $ this -> get ( 'session' ) -> set ( 'export_step_raw' , $ request -> request -> all ( ) ) ; $ this -> get ( 'session' ) -> set ( 'export_step' , $ data ) ; //redirect to next step return $ this -> redirect ( $ this -> generateUrl ( 'chill_main_export_new' , array ( 'step' => $ this -> getNextStep ( 'export' ) , 'alias' => $ alias ) ) ) ; } else { $ this -> get ( 'logger' ) -> debug ( 'form export is invalid' , array ( 'location' => __METHOD__ ) ) ; } } return $ this -> render ( 'ChillMainBundle:Export:new.html.twig' , array ( 'form' => $ form -> createView ( ) , 'export_alias' => $ alias , 'export' => $ export ) ) ; }
Render the export form

When the method is POST, the form is stored if valid, and a redirection
is done to next step.

@param string $alias
@return \Symfony\Component\HttpFoundation\Response
Render the export form