mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-08 15:54:59 +00:00
Fix loading countries
This commit is contained in:
@@ -16,6 +16,7 @@ use Doctrine\ORM\EntityManager;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Intl\Countries;
|
||||
use Symfony\Component\Intl\Intl;
|
||||
|
||||
class LoadCountriesCommand extends Command
|
||||
@@ -32,24 +33,18 @@ class LoadCountriesCommand extends Command
|
||||
|
||||
public static function prepareCountryList($languages)
|
||||
{
|
||||
$regionBundle = Intl::getRegionBundle();
|
||||
$countries = [];
|
||||
|
||||
foreach ($languages as $language) {
|
||||
$countries[$language] = \Symfony\Component\Intl\Currencies::getNames();
|
||||
}
|
||||
|
||||
$countryCodes = Countries::getCountryCodes();
|
||||
$countryEntities = [];
|
||||
|
||||
foreach ($countries[$languages[0]] as $countryCode => $name) {
|
||||
foreach ($countryCodes as $code) {
|
||||
$names = [];
|
||||
|
||||
foreach ($languages as $language) {
|
||||
$names[$language] = $countries[$language][$countryCode];
|
||||
$names[$language] = Countries::getName($code, $language);
|
||||
}
|
||||
|
||||
$country = new \Chill\MainBundle\Entity\Country();
|
||||
$country->setName($names)->setCountryCode($countryCode);
|
||||
$country->setName($names)->setCountryCode($code);
|
||||
$countryEntities[] = $country;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user