Beispiel #1
0
 /**
  * @return ProductInterface
  */
 public function create()
 {
     $product = new Product();
     $product->setAccount($this->getCurrentAccount());
     return $product;
 }
 /**
  * @ApiDoc(
  *  section="Product",
  *  description="Get children products of specified product",
  *  filters={
  *      {"name"="token", "type"="text"}
  *  }
  * )
  * @Method("GET")
  * @Route("/products/{id}/children")
  * @ParamConverter("product", converter="account.doctrine.orm")
  * @param Product $product
  * @return JsonResponse
  */
 public function childrenProductsAction(Product $product)
 {
     if ($product->getChildren()) {
         return new JsonResponse($this->get('perfico_crm.api.transformer')->transformCollection($product->getChildren(), new ProductMap(), 'products'));
     } else {
         return new JsonResponse();
     }
 }