fix redirection on person view: add a person_id to every page redirected.

After a form was submitted, the CRUD controller redirect to page without
a person_id.

Now, the EntityPersonCRUDController redirects to a page **with** a
person_id.
This commit is contained in:
Julien Fastré 2020-06-18 16:41:06 +02:00
parent 4c2ec6761a
commit c3b25b6eeb
2 changed files with 11 additions and 3 deletions

View File

@ -103,4 +103,6 @@ Master branch
- [CRUD] add step delete
- [CRUD] improve index view in person CRUD
- [CRUD] filter by basis on person by default in EntityPersonCRUDController
- [CRUD] override relevant part of the main CRUD template
- [CRUD] fix redirection on person view: add a `person_id` to every page redirected.

View File

@ -117,15 +117,21 @@ class EntityPersonCRUDController extends CRUDController
switch ($next) {
case "save-and-close":
return $this->redirectToRoute('chill_crud_'.$this->getCrudName().'_index', [
'person_id' => $entity->getPerson()->getId()
'person_id' => $this->getPerson($request)->getId()
]);
case "save-and-new":
return $this->redirectToRoute('chill_crud_'.$this->getCrudName().'_new', [
'person_id' => $entity->getPerson()->getId()
'person_id' => $this->getPerson($request)->getId()
]);
case "new":
return $this->redirectToRoute('chill_crud_'.$this->getCrudName().'_view', [
'id' => $entity->getId(),
'person_id' => $this->getPerson($request)->getId()
]);
default:
return $this->redirectToRoute('chill_crud_'.$this->getCrudName().'_view', [
'id' => $entity->getId()
'id' => $entity->getId(),
'person_id' => $this->getPerson($request)->getId()
]);
}
}