mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 23:23:51 +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:
@@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user