1 | <?php |
||
29 | class MovieController extends BaseController |
||
30 | { |
||
31 | /** |
||
32 | * Get all movies. |
||
33 | * |
||
34 | * @Route("/api/movies", methods={"GET"}) |
||
35 | * |
||
36 | * @param Request $request |
||
37 | * @param MovieRepository $movieRepository |
||
38 | * |
||
39 | * @return \Symfony\Component\HttpFoundation\JsonResponse |
||
40 | */ |
||
41 | 8 | public function getAll(Request $request, MovieRepository $movieRepository) |
|
60 | |||
61 | /** |
||
62 | * Get movie resource. |
||
63 | * |
||
64 | * @Route("/api/movies/{id}", methods={"GET"}) |
||
65 | * |
||
66 | * @param int $id |
||
67 | * @param MovieRepository $repository |
||
68 | * @param ProducerInterface $producer |
||
69 | * |
||
70 | * @throws \Doctrine\ORM\NoResultException |
||
71 | * @throws \Doctrine\ORM\NonUniqueResultException |
||
72 | * |
||
73 | * @return JsonResponse |
||
74 | */ |
||
75 | 1 | public function getMovies(int $id, MovieRepository $repository, ProducerInterface $producer) |
|
89 | |||
90 | /** |
||
91 | * Get movies by title. |
||
92 | * |
||
93 | * @Route("/api/movies/search", methods={"POST"}) |
||
94 | * |
||
95 | * @param SearchRequest $request |
||
96 | * @param SearchService $searchService |
||
97 | * @param Request $currentRequest |
||
98 | * |
||
99 | * @throws \Exception |
||
100 | * |
||
101 | * @return \Symfony\Component\HttpFoundation\JsonResponse |
||
102 | */ |
||
103 | 2 | public function getSearch(SearchRequest $request, SearchService $searchService, Request $currentRequest) |
|
115 | |||
116 | /** |
||
117 | * Create new movie. |
||
118 | * |
||
119 | * @Route("/api/movies", methods={"POST"}) |
||
120 | * |
||
121 | * @param CreateMovieRequest $request |
||
122 | * @param MovieManageService $service |
||
123 | * @param ValidatorInterface $validator |
||
124 | * |
||
125 | * @throws \Exception |
||
126 | * |
||
127 | * @return \Symfony\Component\HttpFoundation\JsonResponse |
||
128 | */ |
||
129 | 2 | public function postMovies(CreateMovieRequest $request, MovieManageService $service, ValidatorInterface $validator) |
|
148 | |||
149 | /** |
||
150 | * @Route("/api/movies/{id}", methods={"POST", "PUT", "PATCH"}, requirements={"id"="\d+"}) |
||
151 | * |
||
152 | * @param Movie $movie |
||
153 | * @param UpdateMovieRequest $request |
||
154 | * |
||
155 | * @throws \ErrorException |
||
156 | * @throws \Exception |
||
157 | * |
||
158 | * @return JsonResponse |
||
159 | */ |
||
160 | 2 | public function putMovies(Movie $movie, UpdateMovieRequest $request) |
|
193 | } |
||
194 |