mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
[wip] add actions to crud
This commit is contained in:
parent
9d8e49f39b
commit
7b7ce4a604
@ -64,4 +64,24 @@ class EntityPersonCRUDController extends CRUDController
|
||||
return parent::getTemplateFor($action, $entity, $request);
|
||||
}
|
||||
}
|
||||
|
||||
protected function onBeforeRedirectAfterSubmission(string $action, $entity, \Symfony\Component\Form\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', [
|
||||
'id' => $entity->getPerson()->getId()
|
||||
]);
|
||||
case "save-and-new":
|
||||
return $this->redirectToRoute('chill_crud_'.$this->getCrudName().'_new', [
|
||||
'person_id' => $entity->getPerson()->getId()
|
||||
]);
|
||||
default:
|
||||
return $this->redirectToRoute('chill_crud_'.$this->getCrudName().'_view', [
|
||||
'id' => $entity->getId()
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ class OneToOneEntityPersonCRUDController extends CRUDController
|
||||
$entity = parent::getEntity($action, $id, $request);
|
||||
|
||||
if (NULL === $entity) {
|
||||
$entity = $this->createEntity($request);
|
||||
$entity = $this->createEntity($action, $request);
|
||||
$person = $this->getDoctrine()
|
||||
->getManager()
|
||||
->getRepository(Person::class)
|
||||
|
1
Resources/views/CRUD/_view_title.html.twig
Normal file
1
Resources/views/CRUD/_view_title.html.twig
Normal file
@ -0,0 +1 @@
|
||||
{{ ('crud.' ~ crud_name ~ '.title_view')|trans({'%person%': person|chill_entity_render_string }) }}
|
16
Resources/views/CRUD/view.html.twig
Normal file
16
Resources/views/CRUD/view.html.twig
Normal file
@ -0,0 +1,16 @@
|
||||
{% extends '@ChillPerson/layout.html.twig' %}
|
||||
|
||||
{% set person = entity.person %}
|
||||
{% set activeRouteKey = '' %}
|
||||
|
||||
{% block title %}
|
||||
{% include('@ChillPerson/CRUD/_view_title.html.twig') %}
|
||||
{% endblock %}
|
||||
|
||||
{% block personcontent %}
|
||||
{% embed '@ChillMain/CRUD/_view_content.html.twig' %}
|
||||
{% block crud_content_header %}
|
||||
<h1>{{ ('crud.' ~ crud_name ~ '.title_view')|trans({'%person%': person|chill_entity_render_string }) }}</h1>
|
||||
{% endblock crud_content_header %}
|
||||
{% endembed %}
|
||||
{% endblock %}
|
Loading…
x
Reference in New Issue
Block a user