FEATURE [activity][filter] filter form created to list activities within the parcours and person context

This commit is contained in:
2023-02-15 16:27:34 +01:00
parent 73f332927d
commit 3cc56e7431
5 changed files with 163 additions and 1 deletions

View File

@@ -13,6 +13,7 @@ namespace Chill\ActivityBundle\Controller;
use Chill\ActivityBundle\Entity\Activity;
use Chill\ActivityBundle\Entity\ActivityReason;
use Chill\ActivityBundle\Form\ActivityFilterType;
use Chill\ActivityBundle\Form\ActivityType;
use Chill\ActivityBundle\Repository\ActivityACLAwareRepositoryInterface;
use Chill\ActivityBundle\Repository\ActivityRepository;
@@ -294,6 +295,10 @@ final class ActivityController extends AbstractController
[$person, $accompanyingPeriod] = $this->getEntity($request);
$form = $this->createForm(ActivityFilterType::class);
$form->handleRequest($request);
if ($person instanceof Person) {
$this->denyAccessUnlessGranted(ActivityVoter::SEE, $person);
$activities = $this->activityACLAwareRepository
@@ -307,6 +312,7 @@ final class ActivityController extends AbstractController
$view = 'ChillActivityBundle:Activity:listPerson.html.twig';
} elseif ($accompanyingPeriod instanceof AccompanyingPeriod) {
$this->denyAccessUnlessGranted(ActivityVoter::SEE, $accompanyingPeriod);
$activities = $this->activityACLAwareRepository
@@ -315,9 +321,12 @@ final class ActivityController extends AbstractController
$view = 'ChillActivityBundle:Activity:listAccompanyingCourse.html.twig';
}
return $this->render(
$view,
[
'form' => $form->createView(),
'activities' => $activities,
'person' => $person,
'accompanyingCourse' => $accompanyingPeriod,