public function editPriceNgAction($price_id)
 {
     $em = $this->getDoctrine()->getManager();
     $data = json_decode(file_get_contents("php://input"));
     $parameters = (object) $data;
     $price = Price::editPriceById($em, $price_id, $parameters);
     $response = new Response(json_encode(array("result" => $price->getInArray())));
     $response->headers->set('Content-Type', 'application/json');
     return $response;
 }
 public static function addPrice($em, $parameters)
 {
     $priceCategory = $em->getRepository("RenovateMainBundle:PriceCategory")->find($parameters->categoryid);
     $price = new Price();
     $price->setName($parameters->name);
     $price->setUnits($parameters->units);
     $price->setValue($parameters->value);
     $price->setCategoryid($priceCategory->getId());
     $price->setCategory($priceCategory);
     $price->setCreated(new \DateTime());
     $em->persist($price);
     $em->flush();
     return $price;
 }