public function createAction(Request $request)
    {
        $stocktransfer = new StockTransfer();
        $stocktransfer->setUser($this->getUser());
        $form = $this->createForm(new StockTransferType(), $stocktransfer);
        if ($form->handleRequest($request)->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->persist($stocktransfer);
            $em->flush();

            return $this->redirect($this->generateUrl('stock_transfers_show', array('id' => $stocktransfer->getId())));
        }

        return array(
            'stocktransfer' => $stocktransfer,
            'form' => $form->createView(),
        );
    }
public function createAction(Request $request)
    {
        $stocktransfer = new StockTransfer();
        $stocktransfer->setUser($this->getUser());
        $form = $this->createForm(new StockTransferType(), $stocktransfer);
        if ($form->handleRequest($request)->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->persist($stocktransfer);
            $em->flush();

            return $this->redirect($this->generateUrl('stock_transfers_show', array('id' => $stocktransfer->getId())));
        }

        return array(
            'stocktransfer' => $stocktransfer,
            'form' => $form->createView(),
        );
    }
public function createAction ( Request $ request ) { $ stocktransfer = new StockTransfer ( ) ; $ stocktransfer -> setUser ( $ this -> getUser ( ) ) ; $ form = $ this -> createForm ( new StockTransferType ( ) , $ stocktransfer ) ; if ( $ form -> handleRequest ( $ request ) -> isValid ( ) ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ em -> persist ( $ stocktransfer ) ; $ em -> flush ( ) ; return $ this -> redirect ( $ this -> generateUrl ( 'stock_transfers_show' , array ( 'id' => $ stocktransfer -> getId ( ) ) ) ) ; } return array ( 'stocktransfer' => $ stocktransfer , 'form' => $ form -> createView ( ) , ) ; }
Creates a new StockTransfer entity.

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