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:
@@ -15,6 +15,7 @@ use Chill\MainBundle\Entity\Language;
|
||||
use Doctrine\Bundle\FixturesBundle\Fixture;
|
||||
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
|
||||
/**
|
||||
* Load languages into database.
|
||||
@@ -29,6 +30,12 @@ class LoadLanguages extends Fixture implements OrderedFixtureInterface
|
||||
// This array contains regional code to not exclude
|
||||
private array $regionalVersionToInclude = ['ro_MD'];
|
||||
|
||||
private array $availableLanguages;
|
||||
public function __construct(private readonly ParameterBagInterface $parameterBag)
|
||||
{
|
||||
$this->availableLanguages = $this->parameterBag->get('chill_main.available_languages');
|
||||
}
|
||||
|
||||
public function getOrder(): int
|
||||
{
|
||||
return 10;
|
||||
@@ -62,7 +69,7 @@ class LoadLanguages extends Fixture implements OrderedFixtureInterface
|
||||
{
|
||||
$names = [];
|
||||
|
||||
foreach ($this->container->getParameter('chill_main.available_languages') as $lang) {
|
||||
foreach ($this->availableLanguages as $lang) {
|
||||
$names[$lang] = \Symfony\Component\Intl\Languages::getName($languageCode, $lang);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user