Fixes in template parameters + remove budget elements when removing event

This commit is contained in:
Julie Lenaerts 2025-07-03 10:08:37 +02:00
parent 471e17bbf9
commit 0983140261
7 changed files with 14 additions and 9 deletions

View File

@ -78,6 +78,7 @@ final class EventController extends AbstractController
/** @var array $participations */
$participations = $event->getParticipations();
$budgetElements = $event->getBudgetElements();
$form = $this->createDeleteForm($event_id);
@ -89,6 +90,10 @@ final class EventController extends AbstractController
$em->remove($participation);
}
foreach ($budgetElements as $e) {
$em->remove($e);
}
$em->remove($event);
$em->flush();

View File

@ -228,7 +228,7 @@ final class ParticipationController extends AbstractController
}
return $this->redirectToRoute('chill_event__event_show', [
'event_id' => $participation->getEvent()->getId(),
'id' => $participation->getEvent()->getId(),
]);
}
@ -242,7 +242,7 @@ final class ParticipationController extends AbstractController
/**
* @param int $participation_id
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/participation/{participation_id}/delete', name: 'chill_event_participation_delete', requirements: ['participation_id' => '\d+'], methods: ['GET', 'DELETE'])]
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/participation/{participation_id}/delete', name: 'chill_event_participation_delete', requirements: ['participation_id' => '\d+'])]
public function deleteAction($participation_id, Request $request): Response|\Symfony\Component\HttpFoundation\RedirectResponse
{
$em = $this->managerRegistry->getManager();
@ -273,7 +273,7 @@ final class ParticipationController extends AbstractController
);
return $this->redirectToRoute('chill_event__event_show', [
'event_id' => $event->getId(),
'id' => $event->getId(),
]);
}
}
@ -442,7 +442,7 @@ final class ParticipationController extends AbstractController
));
return $this->redirectToRoute('chill_event__event_show', [
'event_id' => $participation->getEvent()->getId(),
'id' => $participation->getEvent()->getId(),
]);
}

View File

@ -12,7 +12,7 @@
'title' : 'Delete event'|trans,
'confirm_question' : 'Are you sure you want to remove that event ?'|trans,
'cancel_route' : activeRouteKey,
'cancel_parameters' : { 'event_id' : event_id },
'cancel_parameters' : { 'id' : id },
'form' : delete_form
}
) }}

View File

@ -34,7 +34,7 @@
<ul class="record_actions">
<li>
{# {% if is_granted('CHILL_EVENT_SEE_DETAILS', event) %} #}
<a href="{{ path('chill_event__event_show', { 'event_id' : event.id } ) }}" class="btn btn-view">
<a href="{{ path('chill_event__event_show', { 'id' : event.id } ) }}" class="btn btn-view">
{{ 'See'|trans }}
</a>
{# {% endif %} #}

View File

@ -11,7 +11,7 @@
'title' : 'Remove participation'|trans,
'confirm_question' : 'Are you sure you want to remove that participation ?'|trans,
'cancel_route' : activeRouteKey,
'cancel_parameters' : { 'event_id' : event_id },
'cancel_parameters' : { 'id' : event_id },
'form' : delete_form
}
) }}

View File

@ -33,7 +33,7 @@
{% set returnPath = app.request.get('return_path') %}
{% set returnLabel = app.request.get('return_label') %}
<a href="{{ returnPath |default( path('chill_event__event_show', { 'event_id' : participation.event.id } )) }}" class="btn btn-cancel">
<a href="{{ returnPath |default( path('chill_event__event_show', { 'id' : participation.event.id } )) }}" class="btn btn-cancel">
{{ returnLabel |default('Back to the event'|trans) }}
</a>
</li>

View File

@ -34,7 +34,7 @@
<ul class="record_actions sticky-form-buttons">
<li class="cancel">
<a href="{{ path('chill_event__event_show', { 'event_id' : participation.event.id } ) }}" class="btn btn-cancel">
<a href="{{ path('chill_event__event_show', { 'id' : participation.event.id } ) }}" class="btn btn-cancel">
{{ 'Back to the event'|trans }}
</a>
</li>