public function createComment($resourceId, CommentAction $comment)
 {
     $resourceNode = $this->resourceNodeRepository->find($resourceId);
     $comment->setResource($resourceNode);
     $this->em->persist($comment);
     $this->wallItemManager->createWallItem($comment);
     $this->em->flush();
 }
 public function createShare(Request $request, ShareAction $share)
 {
     $return = array();
     $resourceId = $request->get("resourceId");
     if ($resourceId === null) {
         $url = $request->get("url");
         if ($url === null) {
             throw new BadRequestHttpException();
         }
         $share->setUrl($url);
         $return["url"] = $url;
         $title = $request->get("title");
         $share->setTitle($title);
         if ($title !== null) {
             $return["title"] = $title;
         }
     } else {
         $resourceNode = $this->resourceNodeRepository->find($resourceId);
         $share->setResource($resourceNode);
         $return["title"] = $resourceNode->getName();
         $return["url"] = $this->router->generate("claro_resource_open_short", array("node" => $resourceNode->getId()), true);
     }
     $network = $request->get("network");
     $share->setNetwork($network);
     $this->em->persist($share);
     $this->wallItemManager->createWallItem($share);
     $this->em->flush();
     return $return;
 }
 public function createLike(Request $request, LikeAction $like)
 {
     $resourceId = $request->get('resourceId');
     if ($resourceId === null) {
         $url = $request->get('url');
         $title = $request->get('title');
         $like->setUrl($url);
         $like->setTitle($title);
     } else {
         $resourceNode = $this->resourceNodeRepository->find($resourceId);
         $like->setResource($resourceNode);
     }
     $this->em->persist($like);
     $this->wallItemManager->createWallItem($like);
     $this->em->flush();
     return $like;
 }