/** * Returns movie comment * * @ApiDoc( * views={"default", "movie-comment"}, * section="MovieComment API", * statusCodes={ * 200="Returned when successful", * 400="Returned when an error has occurred" * }, * responseMap={ * 200 = {"class": null, "options": {"data_schema": "movie_comment.schema.yml"}} * } * ) * * @Route("movie-comments/{movieComment}", name="api_movie_comment_get_movie_comment", requirements={ * "_scope": "[\w,]+" * }, defaults={"_format": "json"}, methods={"GET"}) * * @RestExtra\Scope(name="list", path="movie_comment/view.yml") * * @param MovieComment $movieComment * @param ScopeFetcherInterface $scopeFetcher * @param Request $request * @return View */ public function getMovieCommentAction(MovieComment $movieComment, ScopeFetcherInterface $scopeFetcher, Request $request) { $datagridBuilder = $this->get('glavweb_datagrid.doctrine_datagrid_builder'); $datagridBuilder->setEntityClassName(MovieComment::class)->setDataSchema('movie_comment.schema.yml', $scopeFetcher->getAvailable($request->get('_scope'), 'movie_comment/view.yml'))->addFilter('id', null, ['operator' => Filter::EQ]); $datagrid = $datagridBuilder->build(['id' => $movieComment->getId()]); return $this->view($datagrid->getItem()); }