src/Flowcode/ShopBundle/Controller/InventoryController.php
/**
     * Displays a form to edit an existing Inventory entity.
     *
     * @Route("/{id}/saveitems", name="stock_inventory_item_update", requirements={"id"="\d+"})
     * @Method("PUT")
     * @Template()
     */
Displays a form to edit an existing Inventory entity.
Displays a form to edit an existing Inventory entity .
public function saveItemsAction(Inventory $inventory, Request $request)
    {
        $editItemsForm = $this->createForm(new InventoryItemsType(), $inventory, array(
            'action' => $this->generateUrl('stock_inventory_item_update', array('id' => $inventory->getid())),
            'method' => 'PUT',
        ));
        if ($editItemsForm->handleRequest($request)->isValid()) {
            $this->getDoctrine()->getManager()->flush();
            return $this->redirect($this->generateUrl('stock_inventory_show', array('id' => $inventory->getId())));
        }
        $deleteForm = $this->createDeleteForm($inventory->getId(), 'stock_inventory_delete');
        $editForm = $this->createForm(new InventoryType(), $inventory, array(
            'action' => $this->generateUrl('stock_inventory_update', array('id' => $inventory->getid())),
            'method' => 'PUT',
        ));
        return array(
            'inventory' => $inventory,
            'edit_form' => $editForm->createView(),
            'editItemsForm' => $editItemsForm,
            'delete_form' => $deleteForm->createView(),
        );
    }
public function saveItemsAction ( Inventory $ inventory , Request $ request ) { $ editItemsForm = $ this -> createForm ( new InventoryItemsType ( ) , $ inventory , array ( 'action' => $ this -> generateUrl ( 'stock_inventory_item_update' , array ( 'id' => $ inventory -> getid ( ) ) ) , 'method' => 'PUT' , ) ) ; if ( $ editItemsForm -> handleRequest ( $ request ) -> isValid ( ) ) { $ this -> getDoctrine ( ) -> getManager ( ) -> flush ( ) ; return $ this -> redirect ( $ this -> generateUrl ( 'stock_inventory_show' , array ( 'id' => $ inventory -> getId ( ) ) ) ) ; } $ deleteForm = $ this -> createDeleteForm ( $ inventory -> getId ( ) , 'stock_inventory_delete' ) ; $ editForm = $ this -> createForm ( new InventoryType ( ) , $ inventory , array ( 'action' => $ this -> generateUrl ( 'stock_inventory_update' , array ( 'id' => $ inventory -> getid ( ) ) ) , 'method' => 'PUT' , ) ) ; return array ( 'inventory' => $ inventory , 'edit_form' => $ editForm -> createView ( ) , 'editItemsForm' => $ editItemsForm , 'delete_form' => $ deleteForm -> createView ( ) , ) ; }
Displays a form to edit an existing Inventory entity.
Displays a form to edit an existing Inventory entity .