Remove ContainerAwareInterface and extend Fixture instead

This commit is contained in:
2025-05-26 14:32:06 +02:00
parent 7cef5e3a76
commit d2bd17632f
6 changed files with 14 additions and 61 deletions

View File

@@ -13,11 +13,10 @@ namespace Chill\MainBundle\DataFixtures\ORM;
use Chill\MainBundle\Entity\GroupCenter;
use Chill\MainBundle\Entity\User;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Persistence\ObjectManager;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Security\Core\Encoder\EncoderFactory;
/**
@@ -26,7 +25,7 @@ use Symfony\Component\Security\Core\Encoder\EncoderFactory;
* create a user for each permission_group and center.
* username and password are identicals.
*/
class LoadUsers extends AbstractFixture implements ContainerAwareInterface, OrderedFixtureInterface
class LoadUsers extends Fixture implements OrderedFixtureInterface
{
public static $refs = [
'center a_social' => [
@@ -52,9 +51,6 @@ class LoadUsers extends AbstractFixture implements ContainerAwareInterface, Orde
'centerB_permission_group_social', ],
],
];
private ?ContainerInterface $container = null;
public function getOrder(): int
{
return 1000;
@@ -91,13 +87,4 @@ class LoadUsers extends AbstractFixture implements ContainerAwareInterface, Orde
$manager->flush();
}
public function setContainer(?ContainerInterface $container = null): void
{
if (null === $container) {
throw new \LogicException('$container should not be null');
}
$this->container = $container;
}
}