mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-26 08:35:00 +00:00
Fix fixtures
- Inject parameters directly instead of getting from container - User PasswordHasher instead of EncoderFactory - set parameters directly and correctly encode values to json
This commit is contained in:
@@ -16,6 +16,7 @@ use Doctrine\Bundle\FixturesBundle\Fixture;
|
||||
use Doctrine\Common\DataFixtures\AbstractFixture;
|
||||
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
|
||||
|
||||
/**
|
||||
@@ -23,6 +24,11 @@ use Doctrine\Persistence\ObjectManager;
|
||||
*/
|
||||
class LoadCountries extends Fixture implements OrderedFixtureInterface
|
||||
{
|
||||
private array $availableLanguages;
|
||||
public function __construct(private readonly ParameterBagInterface $parameterBag)
|
||||
{
|
||||
$this->availableLanguages = $this->parameterBag->get('chill_main.available_languages');
|
||||
}
|
||||
public function getOrder(): int
|
||||
{
|
||||
return 20;
|
||||
@@ -32,7 +38,7 @@ class LoadCountries extends Fixture implements OrderedFixtureInterface
|
||||
{
|
||||
echo "loading countries... \n";
|
||||
|
||||
$languages = $this->container->getParameter('chill_main.available_languages');
|
||||
$languages = $this->availableLanguages;
|
||||
|
||||
foreach (LoadCountriesCommand::prepareCountryList($languages) as $country) {
|
||||
$manager->persist($country);
|
||||
|
Reference in New Issue
Block a user