public function createAction(Request $request) : Response { /** @var CommentDto $commentDto */ $commentDto = $this->dtoFactory->makeDto($request); $this->validationHandler->validate($commentDto); $commentDto = $this->createHandler->create($commentDto); return $this->responseFactory->makeResponse($commentDto, Response::HTTP_CREATED); }
public function removeAction(int $commentId) : Response { $this->deleteHandler->delete($commentId); return $this->responseFactory->makeResponse(); }
public function listAction(int $postId) : JsonResponse { $comments = $this->commentRepository->getCommentsByPostId($postId); $dtoComments = $this->commentsMapper->transformCollection($comments); return $this->responseFactory->makeResponse($dtoComments); }