コード例 #1
0
 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);
 }
コード例 #2
0
 public function removeAction(int $commentId) : Response
 {
     $this->deleteHandler->delete($commentId);
     return $this->responseFactory->makeResponse();
 }
コード例 #3
0
 public function listAction(int $postId) : JsonResponse
 {
     $comments = $this->commentRepository->getCommentsByPostId($postId);
     $dtoComments = $this->commentsMapper->transformCollection($comments);
     return $this->responseFactory->makeResponse($dtoComments);
 }