Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
declare(strict_types=1);
namespace App\Controller;
use App\Service\RestaurantService;
use Nelmio\ApiDocBundle\Annotation\Model;
use OpenApi\Annotations as OA;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
use App\Model\RestaurantList;
#[Route("/api/v1")]
class RestaurantController extends AbstractController
{
public function __construct(private RestaurantService $restaurantService) {}
/**
@OA\OpenApi\Response(response=200, description="Листинг ресторанов")
* @OA\Parameter(
* name="page",
* in="query",
* description="Номер страницы",
* @OA\Schema(type="integer")
* )
* @Model(type=RestaurantList::class)
*/
#[Route('/restaurants', name: 'restaurants', methods: ['GET'])]
public function index(int $page): Response
{
$restaurantsList = $this->restaurantService->getRestaurants();
return $this->json($restaurantsList);
}
}