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

View File

@ -1,12 +1,6 @@
services:
Chill\TaskBundle\Controller\:
resource: "../../Controller"
tags: ["controller.service_arguments"]
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"
autowire: true
autoconfigure: true
tags: ["controller.service_arguments"]