Mid-Level
August 19, 2026Spot the bug: Symfony
One snippet. Find the bug, or prove there isn't one.
php
1<?php
2
3namespace App\Controller;
4
5use Symfony\Component\HttpFoundation\JsonResponse;
6use Symfony\Component\Routing\Attribute\Route;
7
8class OrderController extends AbstractController
9{
10 #[Route('/api/getOrders', methods: ['GET'])]
11 public function list(OrderRepository $repo): JsonResponse
12 {
13 return new JsonResponse($repo->findAll());
14 }
15
16 #[Route('/api/deleteOrder/{id}', methods: ['GET'])]
17 public function delete(int $id, OrderRepository $repo): JsonResponse
18 {
19 $repo->delete($id);
20 return new JsonResponse(['status' => 'ok']);
21 }
22}
23Click the lines that carry the problem.
Your verdict
One attempt per day. The answer shows up right after.
Keep your streak
Create an account to keep your streak and track your progress.