diff --git a/src/CoreBundle/DataFixtures/AccessGroupFixtures.php b/src/CoreBundle/DataFixtures/AccessGroupFixtures.php index 8fb9965aa9..201595aa69 100644 --- a/src/CoreBundle/DataFixtures/AccessGroupFixtures.php +++ b/src/CoreBundle/DataFixtures/AccessGroupFixtures.php @@ -9,20 +9,13 @@ namespace Chamilo\CoreBundle\DataFixtures; use Chamilo\CoreBundle\Repository\GroupRepository; use Doctrine\Bundle\FixturesBundle\Fixture; use Doctrine\Persistence\ObjectManager; -use Symfony\Component\DependencyInjection\ContainerAwareInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; -class AccessGroupFixtures extends Fixture implements ContainerAwareInterface +class AccessGroupFixtures extends Fixture { public function __construct( - private GroupRepository $groupRepository + private readonly GroupRepository $groupRepository ) {} - public function setContainer(?ContainerInterface $container = null): void - { - $this->groupRepository = $container->get(GroupRepository::class); - } - public function load(ObjectManager $manager): void { $this->groupRepository->createDefaultGroups($this); diff --git a/src/CoreBundle/DataFixtures/AccessUserFixtures.php b/src/CoreBundle/DataFixtures/AccessUserFixtures.php index f5bf7f38c5..13d543bfe1 100644 --- a/src/CoreBundle/DataFixtures/AccessUserFixtures.php +++ b/src/CoreBundle/DataFixtures/AccessUserFixtures.php @@ -11,26 +11,18 @@ use Chamilo\CoreBundle\Repository\Node\UserRepository; use Chamilo\CoreBundle\Tool\ToolChain; use Doctrine\Bundle\FixturesBundle\Fixture; use Doctrine\Persistence\ObjectManager; -use Symfony\Component\DependencyInjection\ContainerAwareInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; -class AccessUserFixtures extends Fixture implements ContainerAwareInterface +class AccessUserFixtures extends Fixture { public const ADMIN_USER_REFERENCE = 'admin'; public const ANON_USER_REFERENCE = 'anon'; public const ACCESS_URL_REFERENCE = 'accessUrl'; public function __construct( - private ToolChain $toolChain, - private UserRepository $userRepository + private readonly ToolChain $toolChain, + private readonly UserRepository $userRepository ) {} - public function setContainer(?ContainerInterface $container = null): void - { - $this->toolChain = $container->get(ToolChain::class); - $this->userRepository = $container->get(UserRepository::class); - } - public function load(ObjectManager $manager): void { $timezone = 'Europe\Paris'; diff --git a/src/CoreBundle/DataFixtures/AccessUserUrlFixtures.php b/src/CoreBundle/DataFixtures/AccessUserUrlFixtures.php index a24becde49..6c118b673e 100644 --- a/src/CoreBundle/DataFixtures/AccessUserUrlFixtures.php +++ b/src/CoreBundle/DataFixtures/AccessUserUrlFixtures.php @@ -8,28 +8,19 @@ namespace Chamilo\CoreBundle\DataFixtures; use Chamilo\CoreBundle\Entity\AccessUrl; use Chamilo\CoreBundle\Entity\User; -use Chamilo\CoreBundle\ServiceHelper\ContainerHelper; use Chamilo\CoreBundle\Settings\SettingsManager; use Doctrine\Bundle\FixturesBundle\Fixture; use Doctrine\Persistence\ObjectManager; -use Symfony\Component\DependencyInjection\ContainerAwareInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; -class AccessUserUrlFixtures extends Fixture implements ContainerAwareInterface +class AccessUserUrlFixtures extends Fixture { public function __construct( - private TokenStorageInterface $tokenStorage, - private SettingsManager $settingsManager, + private readonly TokenStorageInterface $tokenStorage, + private readonly SettingsManager $settingsManager, ) {} - public function setContainer(?ContainerInterface $container = null): void - { - $this->tokenStorage = $container->get(ContainerHelper::class)->getTokenStorage(); - $this->settingsManager = $container->get(SettingsManager::class); - } - public function load(ObjectManager $manager): void { /** @var User $admin */ diff --git a/src/CoreBundle/DataFixtures/PageFixtures.php b/src/CoreBundle/DataFixtures/PageFixtures.php index 5984429584..c5d9cb6db7 100644 --- a/src/CoreBundle/DataFixtures/PageFixtures.php +++ b/src/CoreBundle/DataFixtures/PageFixtures.php @@ -10,23 +10,15 @@ use Chamilo\CoreBundle\Component\Utils\CreateDefaultPages; use Chamilo\CoreBundle\Entity\User; use Doctrine\Bundle\FixturesBundle\Fixture; use Doctrine\Persistence\ObjectManager; -use Symfony\Component\DependencyInjection\ContainerAwareInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Contracts\Translation\TranslatorInterface; -class PageFixtures extends Fixture implements ContainerAwareInterface +class PageFixtures extends Fixture { public function __construct( - private CreateDefaultPages $createDefaultPages, - private TranslatorInterface $translator, + private readonly CreateDefaultPages $createDefaultPages, + private readonly TranslatorInterface $translator, ) {} - public function setContainer(?ContainerInterface $container = null): void - { - $this->createDefaultPages = $container->get(CreateDefaultPages::class); - $this->translator = $container->get('translator'); - } - public function load(ObjectManager $manager): void { /** @var User $admin */ diff --git a/src/CoreBundle/DataFixtures/TicketFixtures.php b/src/CoreBundle/DataFixtures/TicketFixtures.php index 5ad5fed3bf..53ac5ae5f3 100644 --- a/src/CoreBundle/DataFixtures/TicketFixtures.php +++ b/src/CoreBundle/DataFixtures/TicketFixtures.php @@ -12,22 +12,15 @@ use Chamilo\CoreBundle\Entity\TicketProject; use Chamilo\CoreBundle\Entity\TicketStatus; use Doctrine\Bundle\FixturesBundle\Fixture; use Doctrine\Persistence\ObjectManager; -use Symfony\Component\DependencyInjection\ContainerAwareInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Contracts\Translation\TranslatorInterface; use TicketManager; -class TicketFixtures extends Fixture implements ContainerAwareInterface +class TicketFixtures extends Fixture { public function __construct( private TranslatorInterface $translator, ) {} - public function setContainer(?ContainerInterface $container = null): void - { - $this->translator = $container->get('translator'); - } - public function load(ObjectManager $manager): void { $adminId = 1;