src/Flowcode/ShopBundle/Controller/AdminWarehouseController.php
/**
     * Creates a new Warehouse entity.
     *
     * @Route("/create", name="admin_warehouse_create")
     * @Method("POST")
     * @Template("FlowcodeShopBundle:AdminWarehouse:new.html.twig")
     */
Creates a new Warehouse entity.
Creates a new Warehouse entity .
public function createAction(Request $request)
    {
        $warehouse = new Warehouse();
        $form = $this->createForm(WarehouseType::class, $warehouse);
        if ($form->handleRequest($request)->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->persist($warehouse);
            $em->flush();
            return $this->redirect($this->generateUrl('admin_warehouse_show', array('id' => $warehouse->getId())));
        }
        return array(
            'warehouse' => $warehouse,
            'form' => $form->createView(),
        );
    }
public function createAction ( Request $ request ) { $ warehouse = new Warehouse ( ) ; $ form = $ this -> createForm ( WarehouseType :: class , $ warehouse ) ; if ( $ form -> handleRequest ( $ request ) -> isValid ( ) ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ em -> persist ( $ warehouse ) ; $ em -> flush ( ) ; return $ this -> redirect ( $ this -> generateUrl ( 'admin_warehouse_show' , array ( 'id' => $ warehouse -> getId ( ) ) ) ) ; } return array ( 'warehouse' => $ warehouse , 'form' => $ form -> createView ( ) , ) ; }
Creates a new Warehouse entity.
Creates a new Warehouse entity .