mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-10-06 21:39:42 +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:
@@ -29,7 +29,7 @@ class PostalCodeController extends AbstractController
|
||||
*/
|
||||
protected $translatableStringHelper;
|
||||
|
||||
public function __construct(TranslatableStringHelper $translatableStringHelper)
|
||||
public function __construct(TranslatableStringHelper $translatableStringHelper, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry)
|
||||
{
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
}
|
||||
@@ -49,7 +49,7 @@ class PostalCodeController extends AbstractController
|
||||
return new JsonResponse(['results' => [], 'pagination' => ['more' => false]]);
|
||||
}
|
||||
|
||||
$query = $this->getDoctrine()->getManager()
|
||||
$query = $this->managerRegistry->getManager()
|
||||
->createQuery(
|
||||
sprintf(
|
||||
'SELECT p.id AS id, p.name AS name, p.code AS code, '
|
||||
|
Reference in New Issue
Block a user