/** * @return Response * * @Rest\RequestParam(name="keyword", description="Keyword value", requirements={ * @Assert\NotBlank() * }) * @Rest\ParamConverter(name="keyword", class="BackBee\NestedNode\KeyWord") * @Rest\Security("is_fully_authenticated() & has_role('ROLE_API_USER')") */ public function putAction(KeyWord $keyword, Request $request) { try { $keywordLabel = trim($request->request->get('keyword')); if ($this->keywordAlreadyExists($keywordLabel, $keyword->getUid())) { throw new BadRequestHttpException('KEYWORD_ALREADY_EXISTS'); } $keyword->setKeyWord($keywordLabel); $this->getEntityManager()->persist($keyword); $this->getEntityManager()->flush(); $response = $this->createJsonResponse(null, 204); } catch (\Exception $e) { $response = $this->createErrorResponse($e); } return $response; }