merge route params in crud admin redirects

This commit is contained in:
Simon Vieille 2022-02-26 20:32:13 +01:00
parent 661840d87c
commit 0af04c9131

View file

@ -68,9 +68,10 @@ abstract class CrudController extends AdminController
$entityManager->create($entity); $entityManager->create($entity);
$this->addFlash('success', 'The data has been saved.'); $this->addFlash('success', 'The data has been saved.');
return $this->redirectToRoute($configuration->getPageRoute('edit'), [ return $this->redirectToRoute($configuration->getPageRoute('edit'), array_merge(
'entity' => $entity->getId(), ['entity' => $entity->getId()],
]); $configuration->getPageRouteParams('edit')
));
} }
$this->addFlash('warning', 'The form is not valid.'); $this->addFlash('warning', 'The form is not valid.');
} }
@ -111,9 +112,10 @@ abstract class CrudController extends AdminController
$entityManager->update($entity); $entityManager->update($entity);
$this->addFlash('success', 'The data has been saved.'); $this->addFlash('success', 'The data has been saved.');
return $this->redirectToRoute($configuration->getPageRoute('edit'), [ return $this->redirectToRoute($configuration->getPageRoute('edit'), array_merge(
'entity' => $entity->getId(), ['entity' => $entity->getId()],
]); $configuration->getPageRouteParams('edit')
));
} }
$this->addFlash('warning', 'The form is not valid.'); $this->addFlash('warning', 'The form is not valid.');
} }