public function createAction(Request $request)
    {
        $inventoryitem = new InventoryItem();
        $form = $this->createForm(new InventoryItemType(), $inventoryitem);
        if ($form->handleRequest($request)->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->persist($inventoryitem);
            $em->flush();

            return $this->redirect($this->generateUrl('stock_inventory_show', array('id' => $inventoryitem->getInventory()->getId())));
        }

        return array(
            'inventoryitem' => $inventoryitem,
            'form' => $form->createView(),
        );
    }
public function createAction(Request $request)
    {
        $inventoryitem = new InventoryItem();
        $form = $this->createForm(new InventoryItemType(), $inventoryitem);
        if ($form->handleRequest($request)->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->persist($inventoryitem);
            $em->flush();

            return $this->redirect($this->generateUrl('stock_inventory_show', array('id' => $inventoryitem->getInventory()->getId())));
        }

        return array(
            'inventoryitem' => $inventoryitem,
            'form' => $form->createView(),
        );
    }
public function createAction ( Request $ request ) { $ inventoryitem = new InventoryItem ( ) ; $ form = $ this -> createForm ( new InventoryItemType ( ) , $ inventoryitem ) ; if ( $ form -> handleRequest ( $ request ) -> isValid ( ) ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ em -> persist ( $ inventoryitem ) ; $ em -> flush ( ) ; return $ this -> redirect ( $ this -> generateUrl ( 'stock_inventory_show' , array ( 'id' => $ inventoryitem -> getInventory ( ) -> getId ( ) ) ) ) ; } return array ( 'inventoryitem' => $ inventoryitem , 'form' => $ form -> createView ( ) , ) ; }
Creates a new InventoryItem entity.

@Route("/create", name="stock_inventoryitem_create")
@Method("POST")
@Template("FlowerStockBundle:InventoryItem:new.html.twig")
Creates a new InventoryItem entity .