mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-11-08 13:18:22 +00:00
apply rector ruleset "symfony constructor injection"
This commit is contained in:
@@ -15,7 +15,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
|
||||
class example extends \Symfony\Bundle\FrameworkBundle\Controller\AbstractController
|
||||
{
|
||||
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry)
|
||||
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry, private readonly \Chill\MainBundle\Pagination\PaginatorFactoryInterface $paginatorFactory)
|
||||
{
|
||||
}
|
||||
public function yourAction(): \Symfony\Component\HttpFoundation\Response
|
||||
@@ -27,7 +27,7 @@ class example extends \Symfony\Bundle\FrameworkBundle\Controller\AbstractControl
|
||||
->getSingleScalarResult();
|
||||
|
||||
// get the PaginatorFactory
|
||||
$paginatorFactory = $this->get('chill_main.paginator_factory');
|
||||
$paginatorFactory = $this->paginatorFactory;
|
||||
|
||||
// create a pagination instance. This instance is only valid for
|
||||
// the current route and parameters
|
||||
|
||||
@@ -18,7 +18,7 @@ use Symfony\Component\Security\Core\Role\Role;
|
||||
|
||||
class ConsultationController extends \Symfony\Bundle\FrameworkBundle\Controller\AbstractController
|
||||
{
|
||||
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry)
|
||||
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry, private readonly \Chill\PersonBundle\Repository\PersonRepository $personRepository)
|
||||
{
|
||||
}
|
||||
/**
|
||||
@@ -31,7 +31,7 @@ class ConsultationController extends \Symfony\Bundle\FrameworkBundle\Controller\
|
||||
public function listAction($id): \Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
/** @var \Chill\PersonBundle\Entity\Person $person */
|
||||
$person = $this->get('chill.person.repository.person')
|
||||
$person = $this->personRepository
|
||||
->find($id);
|
||||
|
||||
if (null === $person) {
|
||||
|
||||
Reference in New Issue
Block a user