Skip to content

Instantly share code, notes, and snippets.

@jocoonopa
Last active December 28, 2015 09:39
Show Gist options
  • Save jocoonopa/7480312 to your computer and use it in GitHub Desktop.
Save jocoonopa/7480312 to your computer and use it in GitHub Desktop.
<?php
/**
* @Route("/purchase/add_new_goods", name="orders_add_new_goods", options={"expose"=true})
*/
public function addNewGoodsAction(Request $request)
{
if ( !$this->postCRSFCheck( $request ) )
return new Response( 'error' );
$em = $this->getDoctrine()->getManager();
$em->getConnection()->beginTransaction();
try{
// 進貨訂單成立
$this->setRequest( $request )
->genGoods()
->putImg()
->setOrdersKind( self::OK_IN )
->setOrdersStatus( self::OS_COMPLETE )
->setPayType( self::PT_CASH )
->newInOrders()
->recordOpe( $this->orders, '成立進貨訂單');
$em->getConnection()->commit();
}catch (Exception $e){
$em->getConnection()->rollback();
throw $e;
}
return new Response( $this->goodsPassport->getGoodsPassportId() );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment