[CRUD] Forward query parameters when pushing button "save and new" in "create" page

This commit is contained in:
Julien Fastré 2020-07-06 13:30:01 +02:00
parent a732393100
commit 567f3f7ec9
2 changed files with 3 additions and 2 deletions

View File

@ -143,4 +143,5 @@ Master Branch
=============
- [Export list] improve alignment of last line
- [CRUD] Forward query parameters when pushing button "save and new" in "create" page;

View File

@ -994,12 +994,12 @@ class CRUDController extends AbstractController
protected function onBeforeRedirectAfterSubmission(string $action, $entity, FormInterface $form, Request $request)
{
$next = $request->request->get("submit", "save-and-close");
switch ($next) {
case "save-and-close":
return $this->redirectToRoute('chill_crud_'.$this->getCrudName().'_index');
case "save-and-new":
return $this->redirectToRoute('chill_crud_'.$this->getCrudName().'_new');
return $this->redirectToRoute('chill_crud_'.$this->getCrudName().'_new', $request->query->all());
default:
return $this->redirectToRoute('chill_crud_'.$this->getCrudName().'_view', [
'id' => $entity->getId()