public function editCostCategoryNgAction($costCategory_id) { $em = $this->getDoctrine()->getManager(); $data = json_decode(file_get_contents("php://input")); $parameters = (object) $data; $costCategory = CostCategory::editCostCategoryById($em, $costCategory_id, $parameters); $response = new Response(json_encode(array("result" => $costCategory->getInArray()))); $response->headers->set('Content-Type', 'application/json'); return $response; }
public static function addCostCategory($em, $parameters) { $costCategory = new CostCategory(); $costCategory->setName($parameters->name); $costCategory->setType($parameters->type); $em->persist($costCategory); $em->flush(); return $costCategory; }