Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
9 / 9 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| Search | |
100.00% |
9 / 9 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| __invoke | |
100.00% |
8 / 8 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace App\Controller\Deposits; |
| 6 | |
| 7 | use App\Controller\BaseController; |
| 8 | use App\Repository\DepositRepository; |
| 9 | use Symfony\Component\HttpFoundation\Request; |
| 10 | use Symfony\Component\HttpFoundation\Response; |
| 11 | use Symfony\Component\Routing\Attribute\Route; |
| 12 | use Symfony\Component\Security\Http\Attribute\IsGranted; |
| 13 | |
| 14 | #[IsGranted('ROLE_ADMIN')] |
| 15 | #[Route(path: '/deposits/search', name: 'deposits_search', methods: ['GET'])] |
| 16 | class Search extends BaseController |
| 17 | { |
| 18 | public function __construct(private readonly DepositRepository $depositRepository) {} |
| 19 | |
| 20 | public function __invoke( |
| 21 | Request $request |
| 22 | ): Response |
| 23 | { |
| 24 | $documentId = $request->query->getInt('q'); |
| 25 | $ids = $this->depositRepository->search($documentId); |
| 26 | |
| 27 | return $this->render( |
| 28 | 'deposit/_search_result.html.twig', |
| 29 | [ |
| 30 | 'ids' => $ids, |
| 31 | ] |
| 32 | ); |
| 33 | } |
| 34 | } |