fix error when displaying list of Person tasks.

This commit is contained in:
Julie Lenaerts 2021-10-04 16:09:40 +02:00
parent b3b54486b5
commit e9d485f814
2 changed files with 27 additions and 36 deletions

View File

@ -2,8 +2,6 @@
namespace Chill\TaskBundle\Controller; namespace Chill\TaskBundle\Controller;
use Chill\MainBundle\Entity\Center;
use Chill\MainBundle\Entity\Scope;
use Chill\PersonBundle\Privacy\PrivacyEvent; use Chill\PersonBundle\Privacy\PrivacyEvent;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
@ -21,20 +19,17 @@ use Symfony\Component\Security\Core\Role\Role;
use Chill\MainBundle\Pagination\PaginatorFactory; use Chill\MainBundle\Pagination\PaginatorFactory;
use Chill\TaskBundle\Repository\SingleTaskRepository; use Chill\TaskBundle\Repository\SingleTaskRepository;
use Chill\MainBundle\Entity\User; use Chill\MainBundle\Entity\User;
use Chill\PersonBundle\Security\Authorization\PersonVoter;
use Chill\PersonBundle\Repository\PersonRepository;
use Chill\TaskBundle\Event\TaskEvent;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Chill\TaskBundle\Event\UI\UIEvent;
use Chill\MainBundle\Repository\CenterRepository; use Chill\MainBundle\Repository\CenterRepository;
use Chill\MainBundle\Repository\ScopeRepository; use Chill\MainBundle\Repository\ScopeRepository;
use Chill\MainBundle\Repository\UserRepository; use Chill\MainBundle\Repository\UserRepository;
use Chill\PersonBundle\Security\Authorization\PersonVoter;
use Chill\TaskBundle\Event\TaskEvent;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Chill\TaskBundle\Event\UI\UIEvent;
use Chill\MainBundle\Timeline\TimelineBuilder; use Chill\MainBundle\Timeline\TimelineBuilder;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Repository\AccompanyingPeriodRepository; use Chill\PersonBundle\Repository\AccompanyingPeriodRepository;
use Chill\PersonBundle\Repository\PersonRepository;
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter; use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
use Symfony\Contracts\Translation\TranslatorInterface as TranslationTranslatorInterface; use Symfony\Contracts\Translation\TranslatorInterface as TranslationTranslatorInterface;
/** /**
@ -50,18 +45,18 @@ class SingleTaskController extends AbstractController
protected LoggerInterface $logger; protected LoggerInterface $logger;
protected EntityRepository $personRepository; protected PersonRepository $personRepository;
protected EntityRepository $courseRepository; protected AccompanyingPeriodRepository $courseRepository;
protected UserRepository $userRepository;
protected CenterRepository $centerRepository;
protected ScopeRepository $scopeRepository;
protected SingleTaskRepository $taskRepository; protected SingleTaskRepository $taskRepository;
protected EntityRepository $userRepository;
protected EntityRepository $centerRepository;
protected EntityRepository $scopeRepository;
/** /**
* SingleTaskController constructor. * SingleTaskController constructor.
* *
@ -71,17 +66,22 @@ class SingleTaskController extends AbstractController
EventDispatcherInterface $eventDispatcher, EventDispatcherInterface $eventDispatcher,
TimelineBuilder $timelineBuilder, TimelineBuilder $timelineBuilder,
LoggerInterface $logger, LoggerInterface $logger,
EntityManagerInterface $em SingleTaskRepository $singleTaskRepository,
PersonRepository $personRepository,
AccompanyingPeriodRepository $courseRepository,
UserRepository $userRepository,
CenterRepository $centerRepository,
ScopeRepository $scopeRepository
) { ) {
$this->eventDispatcher = $eventDispatcher; $this->eventDispatcher = $eventDispatcher;
$this->timelineBuilder = $timelineBuilder; $this->timelineBuilder = $timelineBuilder;
$this->logger = $logger; $this->logger = $logger;
$this->personRepository = $em->getRepository(Person::class); $this->taskRepository = $singleTaskRepository;
$this->courseRepository = $em->getRepository(AccompanyingPeriod::class); $this->scopeRepository = $scopeRepository;
$this->taskRepository = $em->getRepository(SingleTask::class); $this->centerRepository = $centerRepository;
$this->userRepository = $em->getRepository(User::class); $this->userRepository = $userRepository;
$this->centerRepository = $em->getRepository(Center::class); $this->personRepository = $personRepository;
$this->scopeRepository = $em->getRepository(Scope::class); $this->courseRepository = $courseRepository;
} }
@ -533,9 +533,6 @@ class SingleTaskController extends AbstractController
public function listAction( public function listAction(
PaginatorFactory $paginatorFactory, PaginatorFactory $paginatorFactory,
// SingleTaskRepository $taskRepository, // SingleTaskRepository $taskRepository,
// PersonRepository $personRepository,
// AccompanyingPeriodRepository $courseRepository,
// CenterRepository $centerRepository,
FormFactoryInterface $formFactory, FormFactoryInterface $formFactory,
Request $request Request $request
) { ) {

View File

@ -1,12 +1,6 @@
services: services:
Chill\TaskBundle\Controller\: Chill\TaskBundle\Controller\:
resource: "../../Controller" resource: "../../Controller"
tags: ["controller.service_arguments"] autowire: true
autoconfigure: true
Chill\TaskBundle\Controller\SingleTaskController:
arguments:
$eventDispatcher: '@Symfony\Component\EventDispatcher\EventDispatcherInterface'
$timelineBuilder: "@chill_main.timeline_builder"
$logger: "@chill.main.logger"
$em: "@doctrine.orm.default_entity_manager"
tags: ["controller.service_arguments"] tags: ["controller.service_arguments"]