CoreExtraBundle/Controller/SliderController.php
public function newAction(Request $request)
    {
        $slider = new Slider();
        $form = $this->createForm('CoreExtraBundle\Form\SliderType', $slider,  array('uploadDir'=> 'uploads/images/slider' ));
        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            
            //clean image form
            $this->get('core_manager')->cleanImageForm($request->files->get('slider'), $slider);
            
            $em->persist($slider);
            $em->flush();
            
            $this->get('session')->getFlashBag()->add('success', 'slider.created');

            return $this->redirectToRoute('coreextra_slider_index');
        }

        return array(
            'entity' => $slider,
            'form' => $form->createView(),
        );
    }
public function newAction(Request $request)
    {
        $slider = new Slider();
        $form = $this->createForm('CoreExtraBundle\Form\SliderType', $slider,  array('uploadDir'=> 'uploads/images/slider' ));
        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            
            //clean image form
            $this->get('core_manager')->cleanImageForm($request->files->get('slider'), $slider);
            
            $em->persist($slider);
            $em->flush();
            
            $this->get('session')->getFlashBag()->add('success', 'slider.created');

            return $this->redirectToRoute('coreextra_slider_index');
        }

        return array(
            'entity' => $slider,
            'form' => $form->createView(),
        );
    }
public function newAction ( Request $ request ) { $ slider = new Slider ( ) ; $ form = $ this -> createForm ( 'CoreExtraBundle\Form\SliderType' , $ slider , array ( 'uploadDir' => 'uploads/images/slider' ) ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isSubmitted ( ) && $ form -> isValid ( ) ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; //clean image form $ this -> get ( 'core_manager' ) -> cleanImageForm ( $ request -> files -> get ( 'slider' ) , $ slider ) ; $ em -> persist ( $ slider ) ; $ em -> flush ( ) ; $ this -> get ( 'session' ) -> getFlashBag ( ) -> add ( 'success' , 'slider.created' ) ; return $ this -> redirectToRoute ( 'coreextra_slider_index' ) ; } return array ( 'entity' => $ slider , 'form' => $ form -> createView ( ) , ) ; }
Creates a new Slider entity.

@Route("/new")
@Method({"GET", "POST"})
@Template()
Creates a new Slider entity .