Skip to content

Commit fc9cd2a

Browse files
committed
[make:crud] use post method for deletes
1 parent 486a4e8 commit fc9cd2a

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/Resources/skeleton/crud/controller/Controller.tpl.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,10 @@ public function edit(Request $request, <?= $entity_class_name ?> $<?= $entity_va
114114
}
115115

116116
<?php if ($use_attributes) { ?>
117-
#[Route('/{<?= $entity_identifier ?>}', name: '<?= $route_name ?>_delete', methods: ['DELETE'])]
117+
#[Route('/{<?= $entity_identifier ?>}', name: '<?= $route_name ?>_delete', methods: ['POST'])]
118118
<?php } else { ?>
119119
/**
120-
* @Route("/{<?= $entity_identifier ?>}", name="<?= $route_name ?>_delete", methods={"DELETE"})
120+
* @Route("/{<?= $entity_identifier ?>}", name="<?= $route_name ?>_delete", methods={"POST"})
121121
*/
122122
<?php } ?>
123123
public function delete(Request $request, <?= $entity_class_name ?> $<?= $entity_var_singular ?>): Response
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<form method="post" action="{{ path('<?= $route_name ?>_delete', {'<?= $entity_identifier ?>': <?= $entity_twig_var_singular ?>.<?= $entity_identifier ?>}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');">
2-
<input type="hidden" name="_method" value="DELETE">
32
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ <?= $entity_twig_var_singular ?>.<?= $entity_identifier ?>) }}">
43
<button class="btn">Delete</button>
54
</form>

0 commit comments

Comments
 (0)