mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-02 13:03:50 +00:00
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:
@@ -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 (
|
||||
|
Reference in New Issue
Block a user