| @@ 121-135 (lines=15) @@ | ||
| 118 | * |
|
| 119 | * @throws EntityNotFoundException |
|
| 120 | */ |
|
| 121 | public function putAction($id, Request $request) |
|
| 122 | { |
|
| 123 | /** @var CommentInterface $comment */ |
|
| 124 | $comment = $this->get('sulu.repository.comment')->findCommentById($id); |
|
| 125 | if (!$comment) { |
|
| 126 | throw new EntityNotFoundException(CommentInterface::class, $id); |
|
| 127 | } |
|
| 128 | ||
| 129 | $comment->setMessage($request->request->get('message')); |
|
| 130 | ||
| 131 | $this->get('sulu_comment.manager')->update($comment); |
|
| 132 | $this->get('doctrine.orm.entity_manager')->flush(); |
|
| 133 | ||
| 134 | return $this->handleView($this->view($comment)); |
|
| 135 | } |
|
| 136 | ||
| 137 | /** |
|
| 138 | * Delete comment identified by id. |
|
| @@ 114-128 (lines=15) @@ | ||
| 111 | * |
|
| 112 | * @throws EntityNotFoundException |
|
| 113 | */ |
|
| 114 | public function putAction($id, Request $request) |
|
| 115 | { |
|
| 116 | /** @var ThreadInterface $thread */ |
|
| 117 | $thread = $this->get('sulu.repository.thread')->findThreadById($id); |
|
| 118 | if (!$thread) { |
|
| 119 | throw new EntityNotFoundException(ThreadInterface::class, $id); |
|
| 120 | } |
|
| 121 | ||
| 122 | $thread->setTitle($request->request->get('title')); |
|
| 123 | ||
| 124 | $this->get('sulu_comment.manager')->updateThread($thread); |
|
| 125 | $this->get('doctrine.orm.entity_manager')->flush(); |
|
| 126 | ||
| 127 | return $this->handleView($this->view($thread)); |
|
| 128 | } |
|
| 129 | ||
| 130 | /** |
|
| 131 | * Delete thread identified by id. |
|