@@ 94-109 (lines=16) @@ | ||
91 | * @Route("/user/property/{id<\d+>}/edit",methods={"GET", "POST"}, name="user_property_edit") |
|
92 | * @IsGranted("PROPERTY_EDIT", subject="property", message="You cannot change this property.") |
|
93 | */ |
|
94 | public function edit(Request $request, Property $property, AdminPropertyService $service): Response |
|
95 | { |
|
96 | $form = $this->createForm(PropertyType::class, $property); |
|
97 | $form->handleRequest($request); |
|
98 | ||
99 | if ($form->isSubmitted() && $form->isValid()) { |
|
100 | $service->update($property); |
|
101 | ||
102 | return $this->redirectToRoute('user_photo_edit', ['id' => $property->getId()]); |
|
103 | } |
|
104 | ||
105 | return $this->render('user/property/edit.html.twig', [ |
|
106 | 'form' => $form->createView(), |
|
107 | 'site' => $this->site(), |
|
108 | ]); |
|
109 | } |
|
110 | } |
|
111 |
@@ 36-53 (lines=18) @@ | ||
33 | /** |
|
34 | * @Route("/admin/page/new", name="admin_page_new") |
|
35 | */ |
|
36 | public function new(Request $request, PageService $pageService): Response |
|
37 | { |
|
38 | $page = new Page(); |
|
39 | $form = $this->createForm(PageType::class, $page); |
|
40 | $form->handleRequest($request); |
|
41 | ||
42 | if ($form->isSubmitted() && $form->isValid()) { |
|
43 | $pageService->create($page); |
|
44 | ||
45 | return $this->redirectToRoute('page', ['slug' => $page->getSlug()]); |
|
46 | } |
|
47 | ||
48 | return $this->render('admin/page/new.html.twig', [ |
|
49 | 'site' => $this->site(), |
|
50 | 'page' => $page, |
|
51 | 'form' => $form->createView(), |
|
52 | ]); |
|
53 | } |
|
54 | ||
55 | /** |
|
56 | * Displays a form to edit an existing Page entity. |
@@ 38-55 (lines=18) @@ | ||
35 | /** |
|
36 | * @Route("/admin/property/new", name="admin_property_new") |
|
37 | */ |
|
38 | public function new(Request $request, PropertyService $service): Response |
|
39 | { |
|
40 | $property = new Property(); |
|
41 | $form = $this->createForm(PropertyType::class, $property); |
|
42 | $form->handleRequest($request); |
|
43 | ||
44 | if ($form->isSubmitted() && $form->isValid()) { |
|
45 | $service->create($property); |
|
46 | ||
47 | return $this->redirectToRoute('admin_photo_edit', ['id' => $property->getId()]); |
|
48 | } |
|
49 | ||
50 | return $this->render('admin/property/new.html.twig', [ |
|
51 | 'site' => $this->site(), |
|
52 | 'property' => $property, |
|
53 | 'form' => $form->createView(), |
|
54 | ]); |
|
55 | } |
|
56 | ||
57 | /** |
|
58 | * Displays a form to edit an existing Property entity. |
|
@@ 62-77 (lines=16) @@ | ||
59 | * |
|
60 | * @Route("/admin/property/{id<\d+>}/edit",methods={"GET", "POST"}, name="admin_property_edit") |
|
61 | */ |
|
62 | public function edit(Request $request, Property $property, PropertyService $service): Response |
|
63 | { |
|
64 | $form = $this->createForm(PropertyType::class, $property); |
|
65 | $form->handleRequest($request); |
|
66 | ||
67 | if ($form->isSubmitted() && $form->isValid()) { |
|
68 | $service->update($property); |
|
69 | ||
70 | return $this->redirectToRoute('admin_property'); |
|
71 | } |
|
72 | ||
73 | return $this->render('admin/property/edit.html.twig', [ |
|
74 | 'site' => $this->site(), |
|
75 | 'form' => $form->createView(), |
|
76 | ]); |
|
77 | } |
|
78 | ||
79 | /** |
|
80 | * Deletes a Property entity. |