@@ -66,13 +66,20 @@ public function new(Request $request): Response
66
66
$entityManager->persist($<?= $ entity_var_singular ?> );
67
67
$entityManager->flush();
68
68
69
- return $this->redirectToRoute('<?= $ route_name ?> _index');
69
+ return $this->redirectToRoute('<?= $ route_name ?> _index', [], Response::HTTP_SEE_OTHER );
70
70
}
71
71
72
+ <?php if ($ use_render_form ) { ?>
73
+ return $this->renderForm('<?= $ templates_path ?> /new.html.twig', [
74
+ '<?= $ entity_twig_var_singular ?> ' => $<?= $ entity_var_singular ?> ,
75
+ 'form' => $form,
76
+ ]);
77
+ <?php } else { ?>
72
78
return $this->render('<?= $ templates_path ?> /new.html.twig', [
73
79
'<?= $ entity_twig_var_singular ?> ' => $<?= $ entity_var_singular ?> ,
74
80
'form' => $form->createView(),
75
81
]);
82
+ <?php } ?>
76
83
}
77
84
78
85
<?php if ($ use_attributes ) { ?>
@@ -104,13 +111,20 @@ public function edit(Request $request, <?= $entity_class_name ?> $<?= $entity_va
104
111
if ($form->isSubmitted() && $form->isValid()) {
105
112
$this->getDoctrine()->getManager()->flush();
106
113
107
- return $this->redirectToRoute('<?= $ route_name ?> _index');
114
+ return $this->redirectToRoute('<?= $ route_name ?> _index', [], Response::HTTP_SEE_OTHER );
108
115
}
109
116
117
+ <?php if ($ use_render_form ) { ?>
118
+ return $this->renderForm('<?= $ templates_path ?> /edit.html.twig', [
119
+ '<?= $ entity_twig_var_singular ?> ' => $<?= $ entity_var_singular ?> ,
120
+ 'form' => $form,
121
+ ]);
122
+ <?php } else { ?>
110
123
return $this->render('<?= $ templates_path ?> /edit.html.twig', [
111
124
'<?= $ entity_twig_var_singular ?> ' => $<?= $ entity_var_singular ?> ,
112
125
'form' => $form->createView(),
113
126
]);
127
+ <?php } ?>
114
128
}
115
129
116
130
<?php if ($ use_attributes ) { ?>
@@ -128,6 +142,6 @@ public function delete(Request $request, <?= $entity_class_name ?> $<?= $entity_
128
142
$entityManager->flush();
129
143
}
130
144
131
- return $this->redirectToRoute('<?= $ route_name ?> _index');
145
+ return $this->redirectToRoute('<?= $ route_name ?> _index', [], Response::HTTP_SEE_OTHER );
132
146
}
133
147
}
0 commit comments