예제 #1
0
 public function testTransformationException()
 {
     $this->setExpectedException(ApiTransformationException::class);
     $transformer = new CartTransformer();
     $rawItem = '{"customer_id": "1", "item_id1": "2"}';
     $transformer->transform($rawItem);
 }
예제 #2
0
 public function postAddAction(Request $request)
 {
     $response = new ApiResponse();
     $cartModel = $this->get('restapibundle.model.carts');
     $cartTransformer = new CartTransformer();
     $cart = $cartTransformer->transform($request->getContent());
     $cartModel->add($cart, $response);
     return $response->getResponse();
 }