public function createNote($resourceId, NoteAction $note)
 {
     $resourceNode = $this->resourceNodeRepository->find($resourceId);
     $note->setResource($resourceNode);
     $this->em->persist($note);
     $this->em->flush();
 }
 /**
  * @Route("/note/{resourceId}", name="icap_socialmedia_note")
  * @Method({"POST"})
  * @ParamConverter("user", options={"authenticatedUser" = true})
  *
  * @param Request $request
  * @param $resourceId
  * @param User $user
  *
  * @return JsonResponse
  */
 public function noteAction(Request $request, $resourceId, User $user)
 {
     $text = $request->get('social_media_note_text');
     $jsonResponse = new JsonResponse(true);
     if ($text !== null) {
         $note = new NoteAction();
         $note->setUser($user);
         $note->setText($text);
         $this->getNoteActionManager()->createNote($resourceId, $note);
         $jsonResponse = new JsonResponse(true);
     } else {
         $jsonResponse->setStatusCode(Response::HTTP_BAD_REQUEST);
     }
     return $jsonResponse;
 }