1 | <?php |
||
17 | class LabelController extends Controller |
||
18 | { |
||
19 | /** |
||
20 | * @Method("GET") |
||
21 | * @Route("", name="loevgaard_pakkelabels_label_index") |
||
22 | * |
||
23 | * @param Request $request |
||
24 | * |
||
25 | * @return Response |
||
26 | */ |
||
27 | public function indexAction(Request $request) |
||
28 | { |
||
29 | $repos = $this->get('loevgaard_pakkelabels.label_repository'); |
||
30 | |||
31 | $filterForm = $this->createForm('Loevgaard\PakkelabelsBundle\Form\FilterLabelType'); |
||
32 | |||
33 | $qb = $repos->getQueryBuilder(); |
||
34 | |||
35 | if ($request->query->has($filterForm->getName())) { |
||
36 | // manually bind values from the request |
||
37 | $filterForm->submit($request->query->get($filterForm->getName())); |
||
38 | |||
39 | // build the query from the given form object |
||
40 | $this->get('lexik_form_filter.query_builder_updater')->addFilterConditions($filterForm, $qb); |
||
41 | } |
||
42 | |||
43 | /** @var Label[] $labels */ |
||
44 | $labels = $repos->findAllWithPaging($request->query->getInt('page', 1), 100, [], $qb); |
||
45 | |||
46 | return $this->render('@LoevgaardPakkelabels/label/index.html.twig', [ |
||
47 | 'labels' => $labels, |
||
48 | 'filterForm' => $filterForm->createView() |
||
49 | ]); |
||
50 | } |
||
51 | |||
52 | /** |
||
53 | * @Method("GET") |
||
54 | * @Route("/{id}/show", name="loevgaard_pakkelabels_label_show") |
||
55 | * |
||
56 | * @param Label $label |
||
57 | * |
||
58 | * @return Response |
||
59 | */ |
||
60 | public function showAction(Label $label): Response |
||
66 | |||
67 | /** |
||
68 | * @Method("GET") |
||
69 | * @Route("/{id}/image", name="loevgaard_pakkelabels_label_image") |
||
70 | * |
||
71 | * @param Label $label |
||
72 | * |
||
73 | * @return BinaryFileResponse |
||
74 | */ |
||
75 | public function imageAction(Label $label): BinaryFileResponse |
||
84 | |||
85 | /** |
||
86 | * @Method("GET") |
||
87 | * @Route("/{id}/reset-status", name="loevgaard_pakkelabels_label_reset_status") |
||
88 | * |
||
89 | * @param Label $label |
||
90 | * |
||
91 | * @return RedirectResponse |
||
92 | */ |
||
93 | public function resetStatusAction(Label $label): RedirectResponse |
||
101 | } |
||
102 |