Refactor code to directly use Doctrine's ManagerRegistry

Replaced most of the invocations of getDoctrine()->getManager() with ManagerRegistry->getManager(), and added ManagerRegistry injection to controllers where needed. This is part of an ongoing effort to improve code clarity, and avoid unnecessary method chaining in various parts of the codebase.
This commit is contained in:
2023-12-16 19:09:34 +01:00
parent 655dc02538
commit 5703fd0046
54 changed files with 281 additions and 228 deletions

View File

@@ -23,6 +23,9 @@ use Symfony\Component\HttpFoundation\Response;
*/
class EntityPersonCRUDController extends CRUDController
{
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry)
{
}
/**
* Override the base method to add a filtering step to a person.
*
@@ -102,7 +105,7 @@ class EntityPersonCRUDController extends CRUDController
return null;
}
$person = $this->getDoctrine()
$person = $this->managerRegistry
->getRepository(Person::class)
->find($request->query->getInt('person_id'));

View File

@@ -20,6 +20,9 @@ use Symfony\Component\HttpFoundation\Response;
class OneToOneEntityPersonCRUDController extends CRUDController
{
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry)
{
}
protected function generateRedirectOnCreateRoute($action, Request $request, $entity): string
{
throw new \BadMethodCallException('Not implemented yet.');
@@ -31,7 +34,7 @@ class OneToOneEntityPersonCRUDController extends CRUDController
if (null === $entity) {
$entity = $this->createEntity($action, $request);
$person = $this->getDoctrine()
$person = $this->managerRegistry
->getManager()
->getRepository(Person::class)
->find($id);
@@ -58,7 +61,7 @@ class OneToOneEntityPersonCRUDController extends CRUDController
protected function onPostFetchEntity($action, Request $request, $entity): ?Response
{
if (false === $this->getDoctrine()->getManager()->contains($entity)) {
if (false === $this->managerRegistry->getManager()->contains($entity)) {
return new RedirectResponse($this->generateRedirectOnCreateRoute($action, $request, $entity));
}
@@ -67,6 +70,6 @@ class OneToOneEntityPersonCRUDController extends CRUDController
protected function onPreFlush(string $action, $entity, FormInterface $form, Request $request)
{
$this->getDoctrine()->getManager()->persist($entity);
$this->managerRegistry->getManager()->persist($entity);
}
}

View File

@@ -46,7 +46,7 @@ use Symfony\Component\Workflow\Registry;
final class AccompanyingCourseApiController extends ApiController
{
public function __construct(private readonly AccompanyingPeriodRepository $accompanyingPeriodRepository, private readonly AccompanyingPeriodACLAwareRepository $accompanyingPeriodACLAwareRepository, private readonly EventDispatcherInterface $eventDispatcher, private readonly ReferralsSuggestionInterface $referralAvailable, private readonly Registry $registry, private readonly ValidatorInterface $validator) {}
public function __construct(private readonly AccompanyingPeriodRepository $accompanyingPeriodRepository, private readonly AccompanyingPeriodACLAwareRepository $accompanyingPeriodACLAwareRepository, private readonly EventDispatcherInterface $eventDispatcher, private readonly ReferralsSuggestionInterface $referralAvailable, private readonly Registry $registry, private readonly ValidatorInterface $validator, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
public function commentApi($id, Request $request, string $_format): Response
{
@@ -72,7 +72,7 @@ final class AccompanyingCourseApiController extends ApiController
$workflow->apply($accompanyingPeriod, 'confirm');
$this->getDoctrine()->getManager()->flush();
$this->managerRegistry->getManager()->flush();
return $this->json($accompanyingPeriod, Response::HTTP_OK, [], [
'groups' => ['read'],
@@ -172,7 +172,7 @@ final class AccompanyingCourseApiController extends ApiController
return $this->json($errors, 422);
}
$this->getDoctrine()->getManager()->flush();
$this->managerRegistry->getManager()->flush();
return $this->json($participation, 200, [], ['groups' => ['read']]);
}
@@ -220,7 +220,7 @@ final class AccompanyingCourseApiController extends ApiController
return $this->json($errors, 422);
}
$this->getDoctrine()->getManager()->flush();
$this->managerRegistry->getManager()->flush();
return $this->json($accompanyingPeriod->getRequestor(), 200, [], ['groups' => ['read']]);
}
@@ -289,7 +289,7 @@ final class AccompanyingCourseApiController extends ApiController
$accompanyingCourse->setConfidential(!$accompanyingCourse->isConfidential());
$this->getDoctrine()->getManager()->flush();
$this->managerRegistry->getManager()->flush();
}
return $this->json($accompanyingCourse->isConfidential(), Response::HTTP_OK, [], ['groups' => ['read']]);
@@ -307,7 +307,7 @@ final class AccompanyingCourseApiController extends ApiController
$status = 'regular' === $accompanyingCourse->getIntensity() ? 'occasional' : 'regular';
$accompanyingCourse->setIntensity($status);
$this->getDoctrine()->getManager()->flush();
$this->managerRegistry->getManager()->flush();
}
return $this->json($accompanyingCourse->getIntensity(), Response::HTTP_OK, [], ['groups' => ['read']]);

View File

@@ -30,7 +30,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
class AccompanyingCourseCommentController extends AbstractController
{
public function __construct(private readonly EntityManagerInterface $entityManager, private readonly FormFactoryInterface $formFactory, private readonly TranslatorInterface $translator) {}
public function __construct(private readonly EntityManagerInterface $entityManager, private readonly FormFactoryInterface $formFactory, private readonly TranslatorInterface $translator, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
/**
* Page of comments in Accompanying Course section.
@@ -43,7 +43,7 @@ class AccompanyingCourseCommentController extends AbstractController
{
$this->denyAccessUnlessGranted(AccompanyingPeriodVoter::SEE_DETAILS, $accompanyingCourse);
$em = $this->getDoctrine()->getManager();
$em = $this->managerRegistry->getManager();
$afterSuccessfulRedirectResponse = $this->redirectToRoute('chill_person_accompanying_period_comment_list', [
'accompanying_period_id' => $accompanyingCourse->getId(),
]);
@@ -162,7 +162,7 @@ class AccompanyingCourseCommentController extends AbstractController
$comment->getAccompanyingPeriod()->setPinnedComment($comment);
$this->getDoctrine()->getManager()->flush();
$this->managerRegistry->getManager()->flush();
$this->addFlash('success', $this->translator->trans('accompanying_course.comment is pinned'));
@@ -180,7 +180,7 @@ class AccompanyingCourseCommentController extends AbstractController
$comment->getAccompanyingPeriod()->setPinnedComment(null);
$this->getDoctrine()->getManager()->flush();
$this->managerRegistry->getManager()->flush();
$this->addFlash('success', $this->translator->trans('accompanying_course.comment is unpinned'));

View File

@@ -46,6 +46,7 @@ final class AccompanyingCourseController extends \Symfony\Bundle\FrameworkBundle
private readonly TranslatorInterface $translator,
private readonly Security $security,
private readonly PersonRepository $personRepository,
private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry,
) {}
/**
@@ -64,7 +65,7 @@ final class AccompanyingCourseController extends \Symfony\Bundle\FrameworkBundle
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em = $this->managerRegistry->getManager();
$workflow = $this->registry->get($accompanyingCourse);
@@ -102,7 +103,7 @@ final class AccompanyingCourseController extends \Symfony\Bundle\FrameworkBundle
*/
public function deleteAction(Request $request, AccompanyingPeriod $accompanyingCourse)
{
$em = $this->getDoctrine()->getManager();
$em = $this->managerRegistry->getManager();
$person_id = $request->query->get('person_id');
@@ -205,7 +206,7 @@ final class AccompanyingCourseController extends \Symfony\Bundle\FrameworkBundle
}
}
$activities = $this->getDoctrine()->getManager()->getRepository(Activity::class)->findBy(
$activities = $this->managerRegistry->getManager()->getRepository(Activity::class)->findBy(
['accompanyingPeriod' => $accompanyingCourse],
['date' => 'DESC', 'id' => 'DESC'],
);
@@ -239,7 +240,7 @@ final class AccompanyingCourseController extends \Symfony\Bundle\FrameworkBundle
}
$period = new AccompanyingPeriod();
$em = $this->getDoctrine()->getManager();
$em = $this->managerRegistry->getManager();
$personIds = $request->query->all('person_id');
@@ -279,7 +280,7 @@ final class AccompanyingCourseController extends \Symfony\Bundle\FrameworkBundle
}
$period = new AccompanyingPeriod();
$em = $this->getDoctrine()->getManager();
$em = $this->managerRegistry->getManager();
if ($request->query->has('household_id')) {
$householdId = $request->query->get('household_id');
@@ -324,7 +325,7 @@ final class AccompanyingCourseController extends \Symfony\Bundle\FrameworkBundle
if ($form->isSubmitted() && $form->isValid()) {
$accompanyingCourse->reOpen();
$this->getDoctrine()->getManager()->flush();
$this->managerRegistry->getManager()->flush();
return $this->redirectToRoute('chill_person_accompanying_course_index', [
'accompanying_period_id' => $accompanyingCourse->getId(),

View File

@@ -40,7 +40,8 @@ final class AccompanyingCourseWorkController extends AbstractController
private readonly PaginatorFactory $paginator,
private readonly LoggerInterface $chillLogger,
private readonly TranslatableStringHelperInterface $translatableStringHelper,
private readonly FilterOrderHelperFactoryInterface $filterOrderHelperFactory
private readonly FilterOrderHelperFactoryInterface $filterOrderHelperFactory,
private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry
) {}
/**
@@ -87,7 +88,7 @@ final class AccompanyingCourseWorkController extends AbstractController
{
$this->denyAccessUnlessGranted(AccompanyingPeriodWorkVoter::UPDATE, $work);
$em = $this->getDoctrine()->getManager();
$em = $this->managerRegistry->getManager();
$form = $this->createDeleteForm($work->getId());

View File

@@ -38,7 +38,8 @@ class AccompanyingPeriodController extends AbstractController
protected AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository,
private readonly EventDispatcherInterface $eventDispatcher,
private readonly ValidatorInterface $validator,
private readonly TranslatorInterface $translator
private readonly TranslatorInterface $translator,
private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry
) {}
/**
@@ -86,7 +87,7 @@ class AccompanyingPeriodController extends AbstractController
'%name%' => $person->__toString(),
]));
$this->getDoctrine()->getManager()->flush();
$this->managerRegistry->getManager()->flush();
return $this->redirectToRoute('chill_person_accompanying_period_list', [
'person_id' => $person->getId(),
@@ -159,7 +160,7 @@ class AccompanyingPeriodController extends AbstractController
$form->isValid(['Default', 'closed'])
&& 0 === \count($errors)
) {
$em = $this->getDoctrine()->getManager();
$em = $this->managerRegistry->getManager();
$em->persist($accompanyingPeriod);
$em->flush();
$flashBag->add(
@@ -271,7 +272,7 @@ class AccompanyingPeriodController extends AbstractController
['%name%' => $person->__toString()]
));
$this->getDoctrine()->getManager()->flush();
$this->managerRegistry->getManager()->flush();
return $this->redirectToRoute('chill_person_accompanying_period_list', [
'person_id' => $person->getId(),
@@ -327,7 +328,7 @@ class AccompanyingPeriodController extends AbstractController
$this->_validatePerson($person);
$this->getDoctrine()->getManager()->flush();
$this->managerRegistry->getManager()->flush();
$this->addFlash('success', $this->translator->trans(
'The period has been re-opened'
@@ -357,7 +358,7 @@ class AccompanyingPeriodController extends AbstractController
*/
public function updateAction(int $person_id, int $period_id, Request $request): Response
{
$em = $this->getDoctrine()->getManager();
$em = $this->managerRegistry->getManager();
/** @var AccompanyingPeriod $accompanyingPeriod */
$accompanyingPeriod = $em->getRepository(AccompanyingPeriod::class)->find($period_id);
@@ -430,7 +431,7 @@ class AccompanyingPeriodController extends AbstractController
*/
private function _getPerson(int $id): Person
{
$person = $this->getDoctrine()->getManager()
$person = $this->managerRegistry->getManager()
->getRepository(\Chill\PersonBundle\Entity\Person::class)->find($id);
if (null === $person) {

View File

@@ -21,6 +21,9 @@ use Symfony\Component\HttpFoundation\Request;
*/
class ClosingMotiveController extends CRUDController
{
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry)
{
}
/**
* @param string $action
*/
@@ -31,7 +34,7 @@ class ClosingMotiveController extends CRUDController
if ($request->query->has('parent_id')) {
$parentId = $request->query->getInt('parent_id');
$parent = $this->getDoctrine()->getManager()
$parent = $this->managerRegistry->getManager()
->getRepository($this->getEntityClass())
->find($parentId);

View File

@@ -31,7 +31,7 @@ use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
class HouseholdApiController extends ApiController
{
public function __construct(private readonly EventDispatcherInterface $eventDispatcher, private readonly HouseholdRepository $householdRepository, private readonly HouseholdACLAwareRepositoryInterface $householdACLAwareRepository) {}
public function __construct(private readonly EventDispatcherInterface $eventDispatcher, private readonly HouseholdRepository $householdRepository, private readonly HouseholdACLAwareRepositoryInterface $householdACLAwareRepository, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
/**
* @Route("/api/1.0/person/household/by-address-reference/{id}.json",
@@ -93,7 +93,7 @@ class HouseholdApiController extends ApiController
return $this->json($errors, 422);
}
$this->getDoctrine()->getManager()->flush();
$this->managerRegistry->getManager()->flush();
return $this->json(
$address,

View File

@@ -34,7 +34,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
*/
class HouseholdController extends AbstractController
{
public function __construct(private readonly TranslatorInterface $translator, private readonly PositionRepository $positionRepository, private readonly SerializerInterface $serializer, private readonly Security $security) {}
public function __construct(private readonly TranslatorInterface $translator, private readonly PositionRepository $positionRepository, private readonly SerializerInterface $serializer, private readonly Security $security, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
/**
* @Route(
@@ -105,7 +105,7 @@ class HouseholdController extends AbstractController
// TODO ACL
$address_id = $request->query->get('address_id');
$address = $this->getDoctrine()->getManager()
$address = $this->managerRegistry->getManager()
->getRepository(Address::class)
->find($address_id);
@@ -210,7 +210,7 @@ class HouseholdController extends AbstractController
if ($form->isSubmitted() && $form->isValid()) {
$household->makeAddressConsistent();
$this->getDoctrine()->getManager()->flush();
$this->managerRegistry->getManager()->flush();
return $this->redirectToRoute('chill_person_household_addresses', [
'household_id' => $household->getId(),
@@ -244,7 +244,7 @@ class HouseholdController extends AbstractController
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$this->getDoctrine()->getManager()->flush();
$this->managerRegistry->getManager()->flush();
$this->addFlash('success', $this->translator->trans('household.data_saved'));

View File

@@ -44,6 +44,7 @@ class HouseholdMemberController extends ApiController
private readonly HouseholdRepository $householdRepository,
private readonly Security $security,
private readonly PositionRepository $positionRepository,
private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry,
) {}
/**
@@ -62,7 +63,7 @@ class HouseholdMemberController extends ApiController
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$this->getDoctrine()->getManager()->flush();
$this->managerRegistry->getManager()->flush();
$this->addFlash('success', $this->translator
->trans('household.successfully saved member'));
@@ -204,7 +205,7 @@ class HouseholdMemberController extends ApiController
// launch events on post move
$editor->postMove();
$em = $this->getDoctrine()->getManager();
$em = $this->managerRegistry->getManager();
// if new household, persist it
if (

View File

@@ -29,14 +29,14 @@ class PersonAddressController extends AbstractController
/**
* PersonAddressController constructor.
*/
public function __construct(private readonly ValidatorInterface $validator, private readonly TranslatorInterface $translator) {}
public function __construct(private readonly ValidatorInterface $validator, private readonly TranslatorInterface $translator, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/address/create", name="chill_person_address_create", methods={"POST"})
*/
public function createAction(mixed $person_id, Request $request)
{
$person = $this->getDoctrine()->getManager()
$person = $this->managerRegistry->getManager()
->getRepository(\Chill\PersonBundle\Entity\Person::class)
->find($person_id);
@@ -65,7 +65,7 @@ class PersonAddressController extends AbstractController
$this->addFlash('error', $error->getMessage());
}
} elseif ($form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em = $this->managerRegistry->getManager();
$em->flush();
$this->addFlash(
@@ -93,7 +93,7 @@ class PersonAddressController extends AbstractController
*/
public function editAction(mixed $person_id, mixed $address_id)
{
$person = $this->getDoctrine()->getManager()
$person = $this->managerRegistry->getManager()
->getRepository(\Chill\PersonBundle\Entity\Person::class)
->find($person_id);
@@ -123,7 +123,7 @@ class PersonAddressController extends AbstractController
*/
public function listAction(mixed $person_id)
{
$person = $this->getDoctrine()->getManager()
$person = $this->managerRegistry->getManager()
->getRepository(\Chill\PersonBundle\Entity\Person::class)
->find($person_id);
@@ -147,7 +147,7 @@ class PersonAddressController extends AbstractController
*/
public function newAction(mixed $person_id)
{
$person = $this->getDoctrine()->getManager()
$person = $this->managerRegistry->getManager()
->getRepository(\Chill\PersonBundle\Entity\Person::class)
->find($person_id);
@@ -176,7 +176,7 @@ class PersonAddressController extends AbstractController
*/
public function updateAction(mixed $person_id, mixed $address_id, Request $request)
{
$person = $this->getDoctrine()->getManager()
$person = $this->managerRegistry->getManager()
->getRepository(\Chill\PersonBundle\Entity\Person::class)
->find($person_id);
@@ -203,7 +203,7 @@ class PersonAddressController extends AbstractController
$this->addFlash('error', $error->getMessage());
}
} elseif ($form->isValid()) {
$this->getDoctrine()->getManager()
$this->managerRegistry->getManager()
->flush();
$this->addFlash('success', $this->translator->trans(
@@ -276,7 +276,7 @@ class PersonAddressController extends AbstractController
*/
protected function findAddressById(Person $person, $address_id)
{
$address = $this->getDoctrine()->getManager()
$address = $this->managerRegistry->getManager()
->getRepository(Address::class)
->find($address_id);

View File

@@ -39,6 +39,7 @@ class PersonDuplicateController extends \Symfony\Bundle\FrameworkBundle\Controll
private readonly PersonMove $personMove,
private readonly EventDispatcherInterface $eventDispatcher,
private readonly Security $security,
private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry,
) {}
/**
@@ -84,7 +85,7 @@ class PersonDuplicateController extends \Symfony\Bundle\FrameworkBundle\Controll
$sqls = $this->personMove->getSQL($person2, $person1);
$connection = $this->getDoctrine()->getConnection();
$connection = $this->managerRegistry->getConnection();
$connection->beginTransaction();
@@ -173,7 +174,7 @@ class PersonDuplicateController extends \Symfony\Bundle\FrameworkBundle\Controll
'You are not allowed to see this person.'
);
$personNotDuplicate = $this->getDoctrine()->getRepository(PersonNotDuplicate::class)
$personNotDuplicate = $this->managerRegistry->getRepository(PersonNotDuplicate::class)
->findOneBy(['person1' => $person1, 'person2' => $person2]);
if (!$personNotDuplicate instanceof PersonNotDuplicate) {
@@ -182,8 +183,8 @@ class PersonDuplicateController extends \Symfony\Bundle\FrameworkBundle\Controll
$personNotDuplicate->setPerson2($person2);
$personNotDuplicate->setUser($user);
$this->getDoctrine()->getManager()->persist($personNotDuplicate);
$this->getDoctrine()->getManager()->flush();
$this->managerRegistry->getManager()->persist($personNotDuplicate);
$this->managerRegistry->getManager()->flush();
}
return $this->redirectToRoute('chill_person_duplicate_view', ['person_id' => $person1->getId()]);
@@ -202,12 +203,12 @@ class PersonDuplicateController extends \Symfony\Bundle\FrameworkBundle\Controll
'You are not allowed to see this person.'
);
$personNotDuplicate = $this->getDoctrine()->getRepository(PersonNotDuplicate::class)
$personNotDuplicate = $this->managerRegistry->getRepository(PersonNotDuplicate::class)
->findOneBy(['person1' => $person1, 'person2' => $person2]);
if ($personNotDuplicate instanceof PersonNotDuplicate) {
$this->getDoctrine()->getManager()->remove($personNotDuplicate);
$this->getDoctrine()->getManager()->flush();
$this->managerRegistry->getManager()->remove($personNotDuplicate);
$this->managerRegistry->getManager()->flush();
}
return $this->redirectToRoute('chill_person_duplicate_view', ['person_id' => $person1->getId()]);
@@ -244,7 +245,7 @@ class PersonDuplicateController extends \Symfony\Bundle\FrameworkBundle\Controll
private function _getCounters($id): ?array
{
$em = $this->getDoctrine()->getManager();
$em = $this->managerRegistry->getManager();
$nb_activity = $em->getRepository(Activity::class)->findBy(['person' => $id]);
$nb_document = $em->getRepository(PersonDocument::class)->findBy(['person' => $id]);

View File

@@ -27,7 +27,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
final class ResidentialAddressController extends AbstractController
{
public function __construct(private readonly UrlGeneratorInterface $generator, private readonly TranslatorInterface $translator, private readonly ResidentialAddressRepository $residentialAddressRepository) {}
public function __construct(private readonly UrlGeneratorInterface $generator, private readonly TranslatorInterface $translator, private readonly ResidentialAddressRepository $residentialAddressRepository, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
/**
* @Route("/{_locale}/person/residential-address/{id}/delete", name="chill_person_residential_address_delete")
@@ -41,7 +41,7 @@ final class ResidentialAddressController extends AbstractController
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em = $this->managerRegistry->getManager();
$em->remove($residentialAddress);
$em->flush();
@@ -75,7 +75,7 @@ final class ResidentialAddressController extends AbstractController
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$this->getDoctrine()->getManager()->flush();
$this->managerRegistry->getManager()->flush();
$this->addFlash('success', $this->translator
->trans('The residential address was updated successfully'));
@@ -127,8 +127,8 @@ final class ResidentialAddressController extends AbstractController
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$this->getDoctrine()->getManager()->persist($residentialAddress);
$this->getDoctrine()->getManager()->flush();
$this->managerRegistry->getManager()->persist($residentialAddress);
$this->managerRegistry->getManager()->flush();
$this->addFlash('success', $this->translator
->trans('The new residential address was created successfully'));

View File

@@ -22,14 +22,14 @@ use Symfony\Component\HttpFoundation\Request;
class TimelinePersonController extends AbstractController
{
public function __construct(protected EventDispatcherInterface $eventDispatcher, protected TimelineBuilder $timelineBuilder, protected PaginatorFactory $paginatorFactory) {}
public function __construct(protected EventDispatcherInterface $eventDispatcher, protected TimelineBuilder $timelineBuilder, protected PaginatorFactory $paginatorFactory, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/person/{person_id}/timeline", name="chill_person_timeline")
*/
public function personAction(Request $request, mixed $person_id)
{
$person = $this->getDoctrine()
$person = $this->managerRegistry
->getRepository(Person::class)
->find($person_id);