1 | <?php |
||
21 | class GenreController extends FOSRestController implements ControllerInterface |
||
22 | { |
||
23 | /** |
||
24 | * Get all genres |
||
25 | * |
||
26 | * @Route("/api/genres", methods={"GET"}) |
||
27 | * @SWG\Response( |
||
28 | * description="REST action which returns all genres.", |
||
29 | * response=200, |
||
30 | * @SWG\Schema( |
||
31 | * type="array", |
||
32 | * @SWG\Items(ref=@Model(type=Genre::class, groups={"full"})) |
||
33 | * ) |
||
34 | * ) |
||
35 | * |
||
36 | * @return array |
||
37 | */ |
||
38 | 3 | public function getAll() |
|
43 | |||
44 | /** |
||
45 | * Create new genre |
||
46 | * |
||
47 | * @Route("/api/genres", methods={"POST"}) |
||
48 | * @SWG\Parameter(name="genre[translations][0][locale]", in="formData", type="string") |
||
49 | * @SWG\Parameter(name="genre[translations][0][name]", in="formData", type="string") |
||
50 | * @SWG\Response( |
||
51 | * description="New genre action.", |
||
52 | * response=202, |
||
53 | * @Model(type=Genre::class) |
||
54 | * ) |
||
55 | * @param \App\Genres\Request\CreateGenreRequest $request |
||
56 | * @param \App\Genres\Service\GenreManageService $genreManageService |
||
57 | * @param ValidatorInterface $validator |
||
58 | * @return Genre|\Symfony\Component\HttpFoundation\JsonResponse|\Symfony\Component\HttpFoundation\Response |
||
59 | */ |
||
60 | 3 | public function postGenres(CreateGenreRequest $request, GenreManageService $genreManageService, ValidatorInterface $validator) |
|
75 | |||
76 | /** |
||
77 | * Update genre |
||
78 | * |
||
79 | * @Route("/api/genres/{id}", methods={"POST"}) |
||
80 | * @SWG\Parameter(name="genre[translations][0][locale]", in="formData", type="string") |
||
81 | * @SWG\Parameter(name="genre[translations][0][name]", in="formData", type="string") |
||
82 | * @SWG\Response( |
||
83 | * description="New genre action.", |
||
84 | * response=202, |
||
85 | * @Model(type=Genre::class) |
||
86 | * ) |
||
87 | * @param UpdateGenreRequest $request |
||
88 | * @param Genre $genre |
||
89 | * @param \App\Genres\Service\GenreManageService $genreManageService |
||
90 | * @param ValidatorInterface $validator |
||
91 | * @return Genre|\Symfony\Component\HttpFoundation\JsonResponse|\Symfony\Component\HttpFoundation\Response |
||
92 | */ |
||
93 | 1 | public function putGenres(UpdateGenreRequest $request, Genre $genre, GenreManageService $genreManageService, ValidatorInterface $validator) |
|
108 | } |