mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-26 01:23:49 +00:00
activity: edit an activity: choose the context based on the activity, not the url parameters
This commit is contained in:
@@ -105,18 +105,19 @@ final class ActivityController extends AbstractController
|
||||
|
||||
[$person, $accompanyingPeriod] = $this->getEntity($request);
|
||||
|
||||
if ($accompanyingPeriod instanceof AccompanyingPeriod) {
|
||||
$view = 'ChillActivityBundle:Activity:confirm_deleteAccompanyingCourse.html.twig';
|
||||
} elseif ($person instanceof Person) {
|
||||
$view = 'ChillActivityBundle:Activity:confirm_deletePerson.html.twig';
|
||||
}
|
||||
|
||||
$activity = $this->activityRepository->find($id);
|
||||
|
||||
if (!$activity) {
|
||||
throw $this->createNotFoundException('Unable to find Activity entity.');
|
||||
}
|
||||
|
||||
if ($activity->getAccompanyingPeriod() instanceof AccompanyingPeriod) {
|
||||
$view = 'ChillActivityBundle:Activity:confirm_deleteAccompanyingCourse.html.twig';
|
||||
$accompanyingPeriod = $activity->getAccompanyingPeriod();
|
||||
} else {
|
||||
$view = 'ChillActivityBundle:Activity:confirm_deletePerson.html.twig';
|
||||
}
|
||||
|
||||
// TODO
|
||||
// $this->denyAccessUnlessGranted('CHILL_ACTIVITY_DELETE', $activity);
|
||||
|
||||
@@ -176,18 +177,18 @@ final class ActivityController extends AbstractController
|
||||
|
||||
[$person, $accompanyingPeriod] = $this->getEntity($request);
|
||||
|
||||
if ($accompanyingPeriod instanceof AccompanyingPeriod) {
|
||||
$view = 'ChillActivityBundle:Activity:editAccompanyingCourse.html.twig';
|
||||
} elseif ($person instanceof Person) {
|
||||
$view = 'ChillActivityBundle:Activity:editPerson.html.twig';
|
||||
}
|
||||
|
||||
$entity = $this->activityRepository->find($id);
|
||||
|
||||
if (null === $entity) {
|
||||
throw $this->createNotFoundException('Unable to find Activity entity.');
|
||||
}
|
||||
|
||||
if ($entity->getAccompanyingPeriod() instanceof AccompanyingPeriod) {
|
||||
$view = 'ChillActivityBundle:Activity:editAccompanyingCourse.html.twig';
|
||||
$accompanyingPeriod = $entity->getAccompanyingPeriod();
|
||||
} else {
|
||||
$view = 'ChillActivityBundle:Activity:editPerson.html.twig';
|
||||
}
|
||||
// TODO
|
||||
// $this->denyAccessUnlessGranted('CHILL_ACTIVITY_UPDATE', $entity);
|
||||
|
||||
|
Reference in New Issue
Block a user