cs: Fix code style (safe rules only).

This commit is contained in:
Pol Dellaiera
2021-11-23 14:06:38 +01:00
parent 149d7ce991
commit 8f96a1121d
1223 changed files with 65199 additions and 64625 deletions

View File

@@ -1,34 +1,39 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\MainBundle\DataFixtures\ORM;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Persistence\ObjectManager;
use Symfony\Component\Intl\Intl;
use Chill\MainBundle\Entity\Notification;
use DateTimeImmutable;
use Doctrine\Persistence\ObjectManager;
/**
* Load notififications into database
* Load notififications into database.
*/
trait LoadAbstractNotificationsTrait
{
public function load(ObjectManager $manager)
{
return;
foreach ($this->notifs as $notif) {
$entityId = $this->getReference($notif['entityRef'])->getId();
print('Adding notification for '.$notif['entityClass'].'(entity id:'.$entityId.")\n");
echo 'Adding notification for ' . $notif['entityClass'] . '(entity id:' . $entityId . ")\n";
$newNotif = (new Notification())
->setMessage($notif['message'])
->setSender($this->getReference($notif['sender']))
->setRelatedEntityClass($notif['entityClass'])
->setRelatedEntityId($entityId)
->setDate(new \DateTimeImmutable('now'))
->setRead([])
;
->setDate(new DateTimeImmutable('now'))
->setRead([]);
foreach ($notif['addressees'] as $addressee) {
$newNotif->addAddressee($this->getReference($addressee));

View File

@@ -1,49 +1,85 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\MainBundle\DataFixtures\ORM;
use Chill\MainBundle\Doctrine\Model\Point;
use Chill\MainBundle\Entity\AddressReference;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Persistence\ObjectManager;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Doctrine\Persistence\ObjectManager;
use Chill\MainBundle\DataFixtures\ORM\LoadPostalCodes;
use Chill\MainBundle\Entity\AddressReference;
use Chill\MainBundle\Doctrine\Model\Point;
/**
* Load reference addresses into database
*
* @author Champs Libres
* Load reference addresses into database.
*/
class LoadAddressReferences extends AbstractFixture implements ContainerAwareInterface, OrderedFixtureInterface {
class LoadAddressReferences extends AbstractFixture implements ContainerAwareInterface, OrderedFixtureInterface
{
protected $faker;
/**
* @var ContainerInterface
*/
private $container;
public function __construct()
{
$this->faker = \Faker\Factory::create('fr_FR');
}
/**
*
* @var ContainerInterface
*/
private $container;
public function getOrder()
{
return 51;
}
public function setContainer(ContainerInterface $container = null)
public function load(ObjectManager $manager)
{
echo "loading some reference address... \n";
for ($i = 0; 10 > $i; ++$i) {
$ar = $this->getRandomAddressReference();
$manager->persist($ar);
}
$manager->flush();
}
public function setContainer(?ContainerInterface $container = null)
{
$this->container = $container;
}
public function getOrder() {
return 51;
/**
* Create a random reference address.
*
* @return AddressReference
*/
private function getRandomAddressReference()
{
$ar = new AddressReference();
$ar->setRefId($this->faker->numerify('ref-id-######'));
$ar->setStreet($this->faker->streetName);
$ar->setStreetNumber(rand(0, 199));
$ar->setPoint($this->getRandomPoint());
$ar->setPostcode($this->getReference(
LoadPostalCodes::$refs[array_rand(LoadPostalCodes::$refs)]
));
$ar->setMunicipalityCode($ar->getPostcode()->getCode());
return $ar;
}
/**
* Create a random point
* Create a random point.
*
* @return Point
*/
@@ -53,43 +89,7 @@ class LoadAddressReferences extends AbstractFixture implements ContainerAwareInt
$latBrussels = 50.84676;
$lon = $lonBrussels + 0.01 * rand(-5, 5);
$lat = $latBrussels + 0.01 * rand(-5, 5);
return Point::fromLonLat($lon, $lat);
}
/**
* Create a random reference address
*
* @return AddressReference
*/
private function getRandomAddressReference()
{
$ar= new AddressReference();
$ar->setRefId($this->faker->numerify('ref-id-######'));
$ar->setStreet($this->faker->streetName);
$ar->setStreetNumber(rand(0,199));
$ar ->setPoint($this->getRandomPoint());
$ar->setPostcode($this->getReference(
LoadPostalCodes::$refs[array_rand(LoadPostalCodes::$refs)]
));
$ar->setMunicipalityCode($ar->getPostcode()->getCode());
return $ar
;
}
public function load(ObjectManager $manager) {
echo "loading some reference address... \n";
for ($i=0; $i<10; $i++) {
$ar = $this->getRandomAddressReference();
$manager->persist($ar);
}
$manager->flush();
}
}

View File

@@ -1,57 +1,39 @@
<?php
/*
* Chill is a suite of a modules, Chill is a software for social workers
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\MainBundle\DataFixtures\ORM;
use Chill\MainBundle\Entity\Center;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Persistence\ObjectManager;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Chill\MainBundle\Entity\Center;
/**
*
*
* @author Julien Fastré <julien.fastre@champs-libres.coop>
*/
class LoadCenters extends AbstractFixture implements OrderedFixtureInterface
{
public static $centers = [
[
'name' => 'Center A',
'ref' => 'centerA',
],
[
'name' => 'Center B',
'ref' => 'centerB',
],
];
public static $refs = [];
public function getOrder()
{
return 100;
}
public static $centers = array(
array(
'name' => 'Center A',
'ref' => 'centerA'
),
array(
'name' => 'Center B',
'ref' => 'centerB'
)
);
public static $refs = array();
public function load(ObjectManager $manager)
{
foreach (static::$centers as $new) {
@@ -62,7 +44,7 @@ class LoadCenters extends AbstractFixture implements OrderedFixtureInterface
$this->addReference($new['ref'], $center);
static::$refs[] = $new['ref'];
}
$manager->flush();
}
}

View File

@@ -1,5 +1,12 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\MainBundle\DataFixtures\ORM;
use Chill\MainBundle\Entity\Civility;
@@ -17,18 +24,18 @@ class LoadCivility extends Fixture implements FixtureGroupInterface
public function load(ObjectManager $manager): void
{
$civilities = [
['name' => ['fr' => "Monsieur" ], 'abbrev' => ['fr' => 'M.']],
['name' => ['fr' => "Madame" ], 'abbrev' => ['fr' => 'Mme']],
['name' => ['fr' => "Docteur" ], 'abbrev' => ['fr' => 'Dr']],
['name' => ['fr' => "Professeur" ], 'abbrev' => ['fr' => 'Pr']],
['name' => ['fr' => "Madame la Directrice" ], 'abbrev' => ['fr' => 'Mme']],
['name' => ['fr' => "Monsieur le Directeur" ], 'abbrev' => ['fr' => 'M.']],
['name' => ['fr' => "Madame la Maire" ]],
['name' => ['fr' => "Monsieur le Maire" ]],
['name' => ['fr' => "Maître" ], 'abbrev' => ['fr' => 'Me']],
['name' => ['fr' => 'Monsieur'], 'abbrev' => ['fr' => 'M.']],
['name' => ['fr' => 'Madame'], 'abbrev' => ['fr' => 'Mme']],
['name' => ['fr' => 'Docteur'], 'abbrev' => ['fr' => 'Dr']],
['name' => ['fr' => 'Professeur'], 'abbrev' => ['fr' => 'Pr']],
['name' => ['fr' => 'Madame la Directrice'], 'abbrev' => ['fr' => 'Mme']],
['name' => ['fr' => 'Monsieur le Directeur'], 'abbrev' => ['fr' => 'M.']],
['name' => ['fr' => 'Madame la Maire']],
['name' => ['fr' => 'Monsieur le Maire']],
['name' => ['fr' => 'Maître'], 'abbrev' => ['fr' => 'Me']],
];
foreach ( $civilities as $val) {
foreach ($civilities as $val) {
$civility = (new Civility())
->setName($val['name'])
->setAbbreviation($val['abbrev'] ?? [])

View File

@@ -1,48 +1,51 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\MainBundle\DataFixtures\ORM;
use Chill\MainBundle\Command\LoadCountriesCommand;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Persistence\ObjectManager;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Doctrine\Persistence\ObjectManager;
use Chill\MainBundle\Command\LoadCountriesCommand;
/**
* Load countries into database
*
* @author Julien Fastré <julien arobase fastre point info>
* Load countries into database.
*/
class LoadCountries extends AbstractFixture implements ContainerAwareInterface, OrderedFixtureInterface {
class LoadCountries extends AbstractFixture implements ContainerAwareInterface, OrderedFixtureInterface
{
/**
*
* @var ContainerInterface
*/
private $container;
public function setContainer(ContainerInterface $container = null)
public function getOrder()
{
return 20;
}
public function load(ObjectManager $manager)
{
echo "loading countries... \n";
$languages = $this->container->getParameter('chill_main.available_languages');
foreach (LoadCountriesCommand::prepareCountryList($languages) as $country) {
$manager->persist($country);
}
$manager->flush();
}
public function setContainer(?ContainerInterface $container = null)
{
$this->container = $container;
}
public function getOrder() {
return 20;
}
public function load(ObjectManager $manager) {
echo "loading countries... \n";
$languages = $this->container->getParameter('chill_main.available_languages');
foreach (LoadCountriesCommand::prepareCountryList($languages) as $country){
$manager->persist($country);
}
$manager->flush();
}
}

View File

@@ -1,45 +1,27 @@
<?php
/*
* Chill is a suite of a modules, Chill is a software for social workers
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\MainBundle\DataFixtures\ORM;
use Chill\MainBundle\Entity\GroupCenter;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Persistence\ObjectManager;
use Chill\MainBundle\Entity\GroupCenter;
use Chill\MainBundle\DataFixtures\ORM\LoadCenters;
use Chill\MainBundle\DataFixtures\ORM\LoadPermissionsGroup;
/**
*
*
* @author Julien Fastré <julien.fastre@champs-libres.coop>
*/
class LoadGroupCenters extends AbstractFixture implements OrderedFixtureInterface
{
public static $refs = [];
public function getOrder()
{
return 500;
}
public static $refs = array();
public function load(ObjectManager $manager)
{
@@ -48,16 +30,16 @@ class LoadGroupCenters extends AbstractFixture implements OrderedFixtureInterfac
$GroupCenter = new GroupCenter();
$GroupCenter->setCenter($this->getReference($centerRef));
$GroupCenter->setPermissionsGroup($this->getReference($permissionGroupRef));
$manager->persist($GroupCenter);
$reference = $centerRef.'_'.$permissionGroupRef;
$reference = $centerRef . '_' . $permissionGroupRef;
$this->addReference($reference, $GroupCenter);
static::$refs[] = $reference;
echo "Creating $reference... \n";
echo "Creating {$reference}... \n";
}
}
$manager->flush();
}
}

View File

@@ -1,60 +1,57 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\MainBundle\DataFixtures\ORM;
use Chill\MainBundle\Entity\Language;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Persistence\ObjectManager;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Doctrine\Persistence\ObjectManager;
use Symfony\Component\Intl\Intl;
use Chill\MainBundle\Entity\Language;
/**
* Load languages into database
*
* @author Julien Fastré <julien arobase fastre point info>
* Load languages into database.
*/
class LoadLanguages extends AbstractFixture implements ContainerAwareInterface, OrderedFixtureInterface
{
// The regional version of language are language with _ in the code
// This array contains regional code to not exclude
private $regionalVersionToInclude = ["ro_MD"];
// Array of ancien languages (to exclude)
private $ancientToExclude = ["ang", "egy", "fro", "goh", "grc", "la", "non", "peo", "pro", "sga",
"dum", "enm", "frm", "gmh", "mga", "akk", "phn", "zxx", "got", "und"];
private $ancientToExclude = ['ang', 'egy', 'fro', 'goh', 'grc', 'la', 'non', 'peo', 'pro', 'sga',
'dum', 'enm', 'frm', 'gmh', 'mga', 'akk', 'phn', 'zxx', 'got', 'und', ];
/**
*
* @var ContainerInterface
*/
private $container;
public function setContainer(ContainerInterface $container = null)
{
$this->container = $container;
}
// The regional version of language are language with _ in the code
// This array contains regional code to not exclude
private $regionalVersionToInclude = ['ro_MD'];
public function getOrder() {
public function getOrder()
{
return 10;
}
public function load(ObjectManager $manager) {
public function load(ObjectManager $manager)
{
echo "loading languages... \n";
foreach (Intl::getLanguageBundle()->getLanguageNames() as $code => $language) {
if (
!in_array($code, $this->regionalVersionToInclude)
&&
!in_array($code, $this->ancientToExclude)
&& !in_array($code, $this->ancientToExclude)
) {
$lang = (new Language())
->setId($code)
->setName($this->prepareName($code))
;
->setId($code)
->setName($this->prepareName($code));
$manager->persist($lang);
}
}
@@ -62,12 +59,18 @@ class LoadLanguages extends AbstractFixture implements ContainerAwareInterface,
$manager->flush();
}
public function setContainer(?ContainerInterface $container = null)
{
$this->container = $container;
}
/**
* Prepare names for languages.
*
* @return string[] languages name indexed by available language code
*/
private function prepareName(string $languageCode): array {
private function prepareName(string $languageCode): array
{
$names = [];
foreach ($this->container->getParameter('chill_main.available_languages') as $lang) {
@@ -76,6 +79,4 @@ class LoadLanguages extends AbstractFixture implements ContainerAwareInterface,
return $names;
}
}

View File

@@ -1,57 +1,56 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\MainBundle\DataFixtures\ORM;
use Chill\MainBundle\Entity\LocationType;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Persistence\ObjectManager;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Doctrine\Persistence\ObjectManager;
use Chill\MainBundle\Entity\LocationType;
/**
* Load location types into database
*
* @author Champs Libres
* Load location types into database.
*/
class LoadLocationType extends AbstractFixture implements ContainerAwareInterface, OrderedFixtureInterface {
class LoadLocationType extends AbstractFixture implements ContainerAwareInterface, OrderedFixtureInterface
{
/**
*
* @var ContainerInterface
*/
private $container;
public function setContainer(ContainerInterface $container = null)
public function getOrder()
{
$this->container = $container;
}
public function getOrder() {
return 52;
}
public function load(ObjectManager $manager): void {
public function load(ObjectManager $manager): void
{
echo "loading some location type... \n";
$arr = [
[
'name' => ['fr' => 'Mairie'],
'address_required' => LocationType::STATUS_OPTIONAL
'address_required' => LocationType::STATUS_OPTIONAL,
],
[
'name' => ['fr' => 'Guichet d\'accueil'],
'address_required' => LocationType::STATUS_OPTIONAL
'address_required' => LocationType::STATUS_OPTIONAL,
],
[
'name' => ['fr' => 'Domicile de l\'usager'],
'address_required' => LocationType::STATUS_REQUIRED
'address_required' => LocationType::STATUS_REQUIRED,
],
[
'name' => ['fr' => 'Centre d\'aide sociale'],
'address_required' => LocationType::STATUS_OPTIONAL
'address_required' => LocationType::STATUS_OPTIONAL,
],
];
@@ -66,4 +65,9 @@ class LoadLocationType extends AbstractFixture implements ContainerAwareInterfac
$manager->flush();
}
}
public function setContainer(?ContainerInterface $container = null)
{
$this->container = $container;
}
}

View File

@@ -1,87 +1,72 @@
<?php
/*
* Chill is a suite of a modules, Chill is a software for social workers
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\MainBundle\DataFixtures\ORM;
use Chill\MainBundle\Entity\PermissionsGroup;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Persistence\ObjectManager;
use Chill\MainBundle\Entity\PermissionsGroup;
/**
*
*
* @author Julien Fastré <julien.fastre@champs-libres.coop>
*/
class LoadPermissionsGroup extends AbstractFixture implements OrderedFixtureInterface
{
public static $permissionGroup = [
[
'name' => 'social',
'role_scopes' => [
'role_scope_CHILL_FOO_EDIT_social',
'role_scope_CHILL_FOO_SEE_administrative',
'role_scope_CHILL_FOO_EDIT_all',
],
],
[
'name' => 'administrative',
'role_scopes' => [
'role_scope_CHILL_FOO_SEE_social',
'role_scope_CHILL_FOO_EDIT_administrative',
'role_scope_CHILL_FOO_EDIT_all',
],
],
[
'name' => 'direction',
'role_scopes' => [
'role_scope_CHILL_FOO_EDIT_all',
'role_scope_CHILL_FOO_SEE_DETAILS_social',
'role_scope_CHILL_FOO_SEE_DETAILS_administrative',
],
],
];
public static $refs = [];
public function getOrder()
{
return 400;
}
public static $permissionGroup = array(
array(
'name' => 'social',
'role_scopes' => array(
'role_scope_CHILL_FOO_EDIT_social',
'role_scope_CHILL_FOO_SEE_administrative',
"role_scope_CHILL_FOO_EDIT_all"
)
),
array(
'name' => 'administrative',
'role_scopes' => array(
"role_scope_CHILL_FOO_SEE_social",
"role_scope_CHILL_FOO_EDIT_administrative",
"role_scope_CHILL_FOO_EDIT_all"
)
),
array(
'name' => 'direction',
'role_scopes' => array(
"role_scope_CHILL_FOO_EDIT_all",
"role_scope_CHILL_FOO_SEE_DETAILS_social",
"role_scope_CHILL_FOO_SEE_DETAILS_administrative"
)
)
);
public static $refs = array();
public function load(ObjectManager $manager)
{
foreach (static::$permissionGroup as $new) {
$permissionGroup = new PermissionsGroup();
$permissionGroup->setName($new['name']);
foreach ($new['role_scopes'] as $roleScopeRef) {
$permissionGroup->addRoleScope($this->getReference($roleScopeRef));
}
$manager->persist($permissionGroup);
$reference = 'permission_group_'.$new['name'];
echo "Creating $reference \n";
$reference = 'permission_group_' . $new['name'];
echo "Creating {$reference} \n";
$this->setReference($reference, $permissionGroup);
static::$refs[] = $reference;
}
$manager->flush();
}
}

View File

@@ -1,48 +1,334 @@
<?php
/*
/**
* Chill is a software for social workers
*
* Copyright (C) 2014-2016, Champs Libres Cooperative SCRLFS,
* <http://www.champs-libres.coop>, <info@champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\MainBundle\DataFixtures\ORM;
use Chill\MainBundle\Doctrine\Model\Point;
use Chill\MainBundle\Entity\Country;
use Chill\MainBundle\Entity\PostalCode;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Persistence\ObjectManager;
use Chill\MainBundle\Entity\PostalCode;
use function strtolower;
use function ucwords;
/**
* Description of LoadPostalCodes
*
* @author Julien Fastré <julien.fastre@champs-libres.coop>
* @author Champs Libres <info@champs-libres.coop>
* Description of LoadPostalCodes.
*/
class LoadPostalCodes extends AbstractFixture implements OrderedFixtureInterface
{
public static $refs = [];
private static $postalCodeBelgium = <<<'EOF'
1000,BRUXELLES,BE
1020,BRUXELLES,BE
1030,SCHAERBEEK,BE
1040,ETTERBEEK,BE
1050,IXELLES,BE
1060,SAINT-GILLES,BE
1070,ANDERLECHT,BE
1080,MOLENBEEK-SAINT-JEAN,BE
1081,KOEKELBERG,BE
1082,BERCHEM-SAINTE-AGATHE,BE
1083,GANSHOREN,BE
1090,JETTE,BE
1120,BRUXELLES,BE
1130,BRUXELLES,BE
1140,EVERE,BE
1150,WOLUWE-SAINT-PIERRE,BE
1160,AUDERGHEM,BE
1170,WATERMAEL-BOITSFORT,BE
1180,UCCLE,BE
1190,FOREST,BE
1200,WOLUWE-SAINT-LAMBERT,BE
1210,SAINT-JOSSE-TEN-NOODE,BE
1300,WAVRE,BE
1300,WAVRE,BE
1301,WAVRE,BE
1310,LA HULPE,BE
1315,INCOURT,BE
1315,INCOURT,BE
1315,INCOURT,BE
1315,INCOURT,BE
1315,INCOURT,BE
1320,BEAUVECHAIN,BE
EOF;
private static $postalCodeFrance = <<<'EOF'
85000,LA ROCHE SUR YON,FR,85191,46.6675261644,-1.4077954093,INSEE
85000,MOUILLERON LE CAPTIF,FR,85155,46.7104764993,-1.46129661418,INSEE
85100,LES SABLES D OLONNE,FR,85194,46.5007612799,-1.79255128677,INSEE
85110,STE CECILE,FR,85202,46.7309688326,-1.12107316048,INSEE
85110,LA JAUDONNIERE,FR,85115,46.6488761831,-0.962477574588,INSEE
85110,ST GERMAIN DE PRINCAY,FR,85220,46.7356314659,-1.04299885081,INSEE
85110,MONSIREIGNE,FR,85145,46.7383480028,-0.931953130855,INSEE
85110,ST VINCENT STERLANGES,FR,85276,46.7397220689,-1.08371759277,INSEE
85110,SIGOURNAIS,FR,85282,46.7140097406,-0.98747730882,INSEE
85110,CHANTONNAY,FR,85051,46.6690167793,-1.04372588019,INSEE
85110,ST PROUANT,FR,85266,46.7502017421,-0.974504061491,INSEE
85120,LA CHAPELLE AUX LYS,FR,85053,46.6221916887,-0.642706103195,INSEE
85120,VOUVANT,FR,85305,46.5626835135,-0.764380170382,INSEE
85120,ANTIGNY,FR,85005,46.6191770822,-0.767030058653,INSEE
85120,ST MAURICE DES NOUES,FR,85251,46.5955876221,-0.724327725888,INSEE
85120,LOGE FOUGEREUSE,FR,85125,46.6180854641,-0.6899276733,INSEE
85120,LA TARDIERE,FR,85289,46.663737434,-0.727562430214,INSEE
85120,LA CHATAIGNERAIE,FR,85059,46.6416143401,-0.739561966419,INSEE
85120,ST HILAIRE DE VOUST,FR,85229,46.5914988312,-0.651486245674,INSEE
85120,BREUIL BARRET,FR,85037,46.6503266235,-0.671948654426,INSEE
85120,ST PIERRE DU CHEMIN,FR,85264,46.6957771744,-0.701777715154,INSEE
85130,LA GAUBRETIERE,FR,85097,46.9345007303,-1.05578200702,INSEE
85130,ST MARTIN DES TILLEULS,FR,85247,46.9711539531,-1.06282621567,INSEE
85130,TIFFAUGES,FR,85293,47.0020573556,-1.09858009203,INSEE
85130,CHANVERRIE,FR,85302,46.9634774521,-0.985340006089,INSEE
85130,BAZOGES EN PAILLERS,FR,85013,46.9213757643,-1.14415666313,INSEE
85130,LES LANDES GENUSSON,FR,85119,46.9663828627,-1.12900644447,INSEE
85130,ST AUBIN DES ORMEAUX,FR,85198,46.9958175597,-1.04216568722,INSEE
85140,ESSARTS EN BOCAGE,FR,85084,46.7806739038,-1.22925967851,INSEE
85140,LA MERLATIERE,FR,85142,46.7557703112,-1.29794577,INSEE
85140,ST MARTIN DES NOYERS,FR,85246,46.7239461187,-1.20379080965,INSEE
85140,CHAUCHE,FR,85064,46.8282791899,-1.27090860656,INSEE
85150,ST MATHURIN,FR,85250,46.5686332748,-1.70787622288,INSEE
85150,MARTINET,FR,85138,46.6620680463,-1.6772013304,INSEE
85150,STE FLAIVE DES LOUPS,FR,85211,46.611019489,-1.58031627863,INSEE
85150,STE FOY,FR,85214,46.5327600427,-1.69243074733,INSEE
85150,ST JULIEN DES LANDES,FR,85236,46.6395925444,-1.7159724914,INSEE
85150,ST GEORGES DE POINTINDOUX,FR,85218,46.6423470977,-1.62881823574,INSEE
85150,LE GIROUARD,FR,85099,46.5726064909,-1.58872487716,INSEE
85150,LANDERONDE,FR,85118,46.6549237031,-1.57351777893,INSEE
85150,LES ACHARDS,FR,85152,46.6163645636,-1.65038156849,INSEE
85150,VAIRE,FR,85298,46.6055340621,-1.74863672042,INSEE
85160,ST JEAN DE MONTS,FR,85234,46.8021968737,-2.04839789308,INSEE
85170,BELLEVIGNY,FR,85019,46.7756383534,-1.43313700054,INSEE
85170,LE POIRE SUR VIE,FR,85178,46.769919754,-1.50488626452,INSEE
85170,BEAUFOU,FR,85015,46.8191122027,-1.52479250801,INSEE
85170,DOMPIERRE SUR YON,FR,85081,46.7599858068,-1.37275519417,INSEE
85170,LES LUCS SUR BOULOGNE,FR,85129,46.8527299002,-1.48398928084,INSEE
85170,ST DENIS LA CHEVASSE,FR,85208,46.8325959261,-1.3830312677,INSEE
85180,LES SABLES D OLONNE,FR,85194,46.5007612799,-1.79255128677,INSEE
85190,AIZENAY,FR,85003,46.7384516809,-1.62702889721,INSEE
85190,VENANSAULT,FR,85300,46.685677363,-1.54112129191,INSEE
85190,MACHE,FR,85130,46.771364944,-1.69526445062,INSEE
85190,BEAULIEU SOUS LA ROCHE,FR,85016,46.6872087211,-1.62355064963,INSEE
85190,LA GENETOUZE,FR,85098,46.7244524541,-1.50410719693,INSEE
85200,PISSOTTE,FR,85176,46.5010870694,-0.808352236192,INSEE
85200,AUCHAY SUR VENDEE,FR,85009,46.4474386161,-0.876574265149,INSEE
85200,FONTENAY LE COMTE,FR,85092,46.4563186117,-0.793449510859,INSEE
85200,MERVENT,FR,85143,46.5325327351,-0.748519927998,INSEE
85200,DOIX LES FONTAINES,FR,85080,46.3849492327,-0.806840287485,INSEE
85200,LONGEVES,FR,85126,46.4722105292,-0.858917690239,INSEE
85200,ST MARTIN DE FRAIGNEAU,FR,85244,46.4289052087,-0.758948963227,INSEE
85200,SERIGNE,FR,85281,46.5054321828,-0.848819460581,INSEE
85200,BOURNEAU,FR,85033,46.5476882922,-0.813838020265,INSEE
85200,ST MICHEL LE CLOUCQ,FR,85256,46.4861591475,-0.743056336646,INSEE
85200,MONTREUIL,FR,85148,46.3973419593,-0.840846860992,INSEE
85200,L ORBRIE,FR,85167,46.4997145725,-0.77427886573,INSEE
85210,ST JEAN DE BEUGNE,FR,85233,46.5196817523,-1.10826075013,INSEE
85210,ST MARTIN LARS EN STE HERMINE,FR,85248,46.5970244335,-0.976384286709,INSEE
85210,LA REORTHE,FR,85188,46.6113748938,-1.04881036553,INSEE
85210,ST AUBIN LA PLAINE,FR,85199,46.5040293195,-1.06506577005,INSEE
85210,ST JUIRE CHAMPGILLON,FR,85235,46.5882648491,-1.00959676911,INSEE
85210,LA CHAPELLE THEMER,FR,85056,46.5639307793,-0.960376685588,INSEE
85210,ST ETIENNE DE BRILLOUET,FR,85209,46.5138850327,-1.01157660374,INSEE
85210,STE HERMINE,FR,85223,46.5572659953,-1.07210861039,INSEE
85210,THIRE,FR,85290,46.5433098199,-1.00699777534,INSEE
85220,ST MAIXENT SUR VIE,FR,85239,46.7329496925,-1.82595152879,INSEE
85220,LA CHAIZE GIRAUD,FR,85045,46.6476375058,-1.81865076161,INSEE
85220,LANDEVIEILLE,FR,85120,46.6444349925,-1.7854367847,INSEE
85220,L AIGUILLON SUR VIE,FR,85002,46.6706426618,-1.82599992318,INSEE
85220,COEX,FR,85070,46.7078707764,-1.75788339462,INSEE
85220,ST REVEREND,FR,85268,46.7057741864,-1.83155480996,INSEE
85220,APREMONT,FR,85006,46.7572682339,-1.74841313647,INSEE
85220,LA CHAPELLE HERMIER,FR,85054,46.6826679204,-1.72083372442,INSEE
85220,COMMEQUIERS,FR,85071,46.7674752232,-1.82534079642,INSEE
85230,BEAUVOIR SUR MER,FR,85018,46.9086155426,-2.06349351302,INSEE
85230,BOUIN,FR,85029,46.9815930867,-2.00423808381,INSEE
85230,ST URBAIN,FR,85273,46.8818371328,-2.01607828912,INSEE
85230,ST GERVAIS,FR,85221,46.9285711589,-1.98059327519,INSEE
85240,MARILLET,FR,85136,46.5667525381,-0.634287713939,INSEE
85240,ST HILAIRE DES LOGES,FR,85227,46.4747117878,-0.650611151998,INSEE
85240,FAYMOREAU,FR,85087,46.5427361252,-0.624271378946,INSEE
85240,XANTON CHASSENON,FR,85306,46.4519408659,-0.706316598666,INSEE
85240,FOUSSAIS PAYRE,FR,85094,46.5230750581,-0.687135962627,INSEE
85240,RIVES D AUTISE,FR,85162,46.424726987,-0.665995249042,INSEE
85240,PUY DE SERRE,FR,85184,46.5650384637,-0.680144631346,INSEE
85250,ST ANDRE GOULE D OIE,FR,85196,46.8410224478,-1.19644211396,INSEE
85250,LA RABATELIERE,FR,85186,46.8584147661,-1.2569733759,INSEE
85250,CHAVAGNES EN PAILLERS,FR,85065,46.8951394423,-1.24054768713,INSEE
85250,ST FULGENT,FR,85215,46.8705618525,-1.16246465678,INSEE
85250,VENDRENNES,FR,85301,46.8226741756,-1.11650982164,INSEE
85260,LA COPECHAGNIERE,FR,85072,46.8523980181,-1.34349746898,INSEE
85260,L HERBERGEMENT,FR,85108,46.9166207979,-1.37033557148,INSEE
85260,MONTREVERD,FR,85197,46.9277672307,-1.4126154924,INSEE
85260,LES BROUZILS,FR,85038,46.8854235235,-1.33186892233,INSEE
85270,NOTRE DAME DE RIEZ,FR,85189,46.7532179022,-1.8935292542,INSEE
85270,ST HILAIRE DE RIEZ,FR,85226,46.7432732188,-1.96439228965,INSEE
85280,LA FERRIERE,FR,85089,46.7215872927,-1.33469332327,INSEE
85290,MORTAGNE SUR SEVRE,FR,85151,46.9910941319,-0.946500033344,INSEE
85290,ST LAURENT SUR SEVRE,FR,85238,46.9506837971,-0.901123752328,INSEE
85300,CHALLANS,FR,85047,46.8354416653,-1.84036683139,INSEE
85300,FROIDFOND,FR,85095,46.8789464367,-1.75511438567,INSEE
85300,SOULLANS,FR,85284,46.7951288466,-1.91392699457,INSEE
85300,LE PERRIER,FR,85172,46.8196487652,-1.97926629071,INSEE
85300,SALLERTAINE,FR,85280,46.8659054157,-1.94894081389,INSEE
85310,LA CHAIZE LE VICOMTE,FR,85046,46.6729533879,-1.29188591019,INSEE
85310,NESMY,FR,85160,46.5921936479,-1.40947698594,INSEE
85310,RIVES DE L YON,FR,85213,46.605637391,-1.3354497172,INSEE
85310,LE TABLIER,FR,85285,46.5596307281,-1.32788759657,INSEE
85320,CHATEAU GUIBERT,FR,85061,46.5741109302,-1.25524886228,INSEE
85320,LES PINEAUX,FR,85175,46.599225902,-1.17865799724,INSEE
85320,ROSNAY,FR,85193,46.5324344973,-1.3007139449,INSEE
85320,BESSAY,FR,85023,46.5397253861,-1.17028433093,INSEE
85320,LA BRETONNIERE LA CLAYE,FR,85036,46.4879459421,-1.26773426545,INSEE
85320,CORPE,FR,85073,46.5050234767,-1.17034425311,INSEE
85320,MAREUIL SUR LAY DISSAIS,FR,85135,46.5335825488,-1.22688907859,INSEE
85320,PEAULT,FR,85171,46.502029199,-1.22708559855,INSEE
85320,LA COUTURE,FR,85074,46.523938732,-1.26493227292,INSEE
85320,MOUTIERS SUR LE LAY,FR,85157,46.5651677306,-1.16826489836,INSEE
85320,STE PEXINE,FR,85261,46.5596018797,-1.12406235901,INSEE
85330,NOIRMOUTIER EN L ILE,FR,85163,47.0086655085,-2.26243620205,INSEE
85340,L ILE D OLONNE,FR,85112,46.570163703,-1.7737502368,INSEE
85340,LES SABLES D OLONNE,FR,85194,46.5007612799,-1.79255128677,INSEE
85350,L ILE D YEU,FR,85113,46.7093514816,-2.34712702345,INSEE
85360,LA TRANCHE SUR MER,FR,85294,46.3564601605,-1.43136322126,INSEE
85370,MOUZEUIL ST MARTIN,FR,85158,46.4591118412,-0.984449849889,INSEE
85370,NALLIERS,FR,85159,46.4658962703,-1.03958611312,INSEE
85370,LE LANGON,FR,85121,46.4393119039,-0.947017086151,INSEE
85390,BAZOGES EN PAREDS,FR,85014,46.6602005512,-0.914053446792,INSEE
85390,ST MAURICE LE GIRARD,FR,85252,46.6398624578,-0.810875649028,INSEE
85390,TALLUD STE GEMME,FR,85287,46.6949386862,-0.886169517112,INSEE
85390,CHAVAGNES LES REDOUX,FR,85066,46.7101499475,-0.915900131393,INSEE
85390,CHEFFOIS,FR,85067,46.6786935635,-0.782949851125,INSEE
85390,MOUILLERON ST GERMAIN,FR,85154,46.6612700667,-0.846784201071,INSEE
85400,STE GEMME LA PLAINE,FR,85216,46.4732196212,-1.11103084694,INSEE
85400,LAIROUX,FR,85117,46.4496842668,-1.27114022202,INSEE
85400,LUCON,FR,85128,46.4510564854,-1.16449285012,INSEE
85400,LES MAGNILS REIGNIERS,FR,85131,46.4635045649,-1.210635375,INSEE
85400,CHASNAIS,FR,85058,46.4459908481,-1.2385924923,INSEE
85410,ST LAURENT DE LA SALLE,FR,85237,46.5854041653,-0.922177315485,INSEE
85410,LA CAILLERE ST HILAIRE,FR,85040,46.6293907412,-0.933153931505,INSEE
85410,ST CYR DES GATS,FR,85205,46.572397925,-0.86344873853,INSEE
85410,THOUARSAIS BOUILDROUX,FR,85292,46.6062740621,-0.873461023865,INSEE
85410,CEZAIS,FR,85041,46.5917363748,-0.802618133558,INSEE
85410,ST SULPICE EN PAREDS,FR,85271,46.6130038733,-0.8310839288,INSEE
85420,LE MAZEAU,FR,85139,46.3298580373,-0.672957405035,INSEE
85420,LIEZ,FR,85123,46.3698532376,-0.70502476758,INSEE
85420,BOUILLE COURDAULT,FR,85028,46.3847932448,-0.684917815779,INSEE
85420,DAMVIX,FR,85078,46.32063079,-0.743504259797,INSEE
85420,MAILLE,FR,85132,46.3417503082,-0.787487297301,INSEE
85420,ST PIERRE LE VIEUX,FR,85265,46.4009643491,-0.742816267425,INSEE
85420,ST SIGISMOND,FR,85269,46.3368577973,-0.707293731101,INSEE
85420,MAILLEZAIS,FR,85133,46.3642178261,-0.750260780443,INSEE
85420,RIVES D AUTISE,FR,85162,46.424726987,-0.665995249042,INSEE
85430,AUBIGNY LES CLOUZEAUX,FR,85008,46.6028241769,-1.46743549114,INSEE
85430,NIEUL LE DOLENT,FR,85161,46.5676509922,-1.51560194548,INSEE
85430,LA BOISSIERE DES LANDES,FR,85026,46.5581861734,-1.44371985689,INSEE
85440,ST HILAIRE LA FORET,FR,85231,46.4551155186,-1.53048160541,INSEE
85440,TALMONT ST HILAIRE,FR,85288,46.475786445,-1.62751498166,INSEE
85440,POIROUX,FR,85179,46.5107890457,-1.53929317556,INSEE
85440,GROSBREUIL,FR,85103,46.5390090882,-1.6072005484,INSEE
85440,AVRILLE,FR,85010,46.4744272125,-1.49524360118,INSEE
85450,CHAMPAGNE LES MARAIS,FR,85049,46.3735020647,-1.13380723653,INSEE
85450,LA TAILLEE,FR,85286,46.3852513569,-0.941017792066,INSEE
85450,CHAILLE LES MARAIS,FR,85042,46.3853555319,-1.01044079362,INSEE
85450,VOUILLE LES MARAIS,FR,85304,46.3891941167,-0.968106001439,INSEE
85450,MOREILLES,FR,85149,46.4218721314,-1.09404530407,INSEE
85450,PUYRAVAULT,FR,85185,46.3653834101,-1.09115660367,INSEE
85450,STE RADEGONDE DES NOYERS,FR,85267,46.3694246909,-1.06671995264,INSEE
85460,LA FAUTE SUR MER,FR,85307,46.3199919131,-1.31487049579,INSEE
85460,L AIGUILLON SUR MER,FR,85001,46.304138479,-1.2623239198,INSEE
85470,BRETIGNOLLES SUR MER,FR,85035,46.6374826705,-1.86324200464,INSEE
85470,BREM SUR MER,FR,85243,46.6118566989,-1.81003917923,INSEE
85480,BOURNEZEAU,FR,85034,46.6296975315,-1.14101742229,INSEE
85480,FOUGERE,FR,85093,46.6617881911,-1.23612691916,INSEE
85480,ST HILAIRE LE VOUHIS,FR,85232,46.6859198669,-1.15222590884,INSEE
85480,THORIGNY,FR,85291,46.6179795025,-1.24888057642,INSEE
85490,BENET,FR,85020,46.368873213,-0.613959918706,INSEE
85500,BEAUREPAIRE,FR,85017,46.9050210355,-1.10144867013,INSEE
85500,ST PAUL EN PAREDS,FR,85259,46.8303789022,-0.964515191283,INSEE
85500,LES HERBIERS,FR,85109,46.8666125813,-1.02216086186,INSEE
85500,MESNARD LA BAROTIERE,FR,85144,46.851716793,-1.10954466033,INSEE
85500,CHANVERRIE,FR,85302,46.9634774521,-0.985340006089,INSEE
85510,ROCHETREJOUX,FR,85192,46.7852546732,-0.996743019108,INSEE
85510,LE BOUPERE,FR,85031,46.7877960262,-0.930897406714,INSEE
85520,JARD SUR MER,FR,85114,46.4246376808,-1.60014921643,INSEE
85520,ST VINCENT SUR JARD,FR,85278,46.4297504489,-1.54956205778,INSEE
85530,LA BRUFFIERE,FR,85039,47.0148006973,-1.18329758318,INSEE
85540,LE CHAMP ST PERE,FR,85050,46.5157210212,-1.33946630196,INSEE
85540,LE GIVRE,FR,85101,46.4729146043,-1.40256149118,INSEE
85540,MOUTIERS LES MAUXFAITS,FR,85156,46.489279204,-1.43622387207,INSEE
85540,ST VINCENT SUR GRAON,FR,85277,46.5034756656,-1.382954206,INSEE
85540,LA JONCHERE,FR,85116,46.4358647401,-1.38517843312,INSEE
85540,ST BENOIST SUR MER,FR,85201,46.4266286403,-1.3399129604,INSEE
85540,CURZON,FR,85077,46.4512376923,-1.30138059216,INSEE
85540,ST AVAUGOURD DES LANDES,FR,85200,46.5136722903,-1.47528120789,INSEE
85540,ST CYR EN TALMONDAIS,FR,85206,46.4597334032,-1.33722144355,INSEE
85550,LA BARRE DE MONTS,FR,85012,46.8722784154,-2.09984018879,INSEE
85560,LE BERNARD,FR,85022,46.44832528,-1.43979865314,INSEE
85560,LONGEVILLE SUR MER,FR,85127,46.4091029013,-1.47711855345,INSEE
85570,POUILLE,FR,85181,46.5022256779,-0.955223380119,INSEE
85570,ST VALERIEN,FR,85274,46.5348508899,-0.944470507825,INSEE
85570,L HERMENAULT,FR,85110,46.5156262822,-0.898430664265,INSEE
85570,PETOSSE,FR,85174,46.4796848965,-0.911734176662,INSEE
85570,ST MARTIN DES FONTAINES,FR,85245,46.5464637508,-0.907394581139,INSEE
85570,MARSAIS STE RADEGONDE,FR,85137,46.5380790745,-0.868868309437,INSEE
85580,ST DENIS DU PAYRE,FR,85207,46.4118936776,-1.27222282402,INSEE
85580,ST MICHEL EN L HERM,FR,85255,46.3366903175,-1.2483968538,INSEE
85580,TRIAIZE,FR,85297,46.3792685111,-1.19928351422,INSEE
85580,GRUES,FR,85104,46.3813091348,-1.32364519268,INSEE
85590,TREIZE VENTS,FR,85296,46.9168130123,-0.845959158017,INSEE
85590,LES EPESSES,FR,85082,46.8917166066,-0.903422756546,INSEE
85590,MALLIEVRE,FR,85134,46.9112847287,-0.864977836096,INSEE
85590,ST MALO DU BOIS,FR,85240,46.9248120291,-0.914182961099,INSEE
85590,ST MARS LA REORTHE,FR,85242,46.8597253005,-0.925777900202,INSEE
85600,LA BOISSIERE DE MONTAIGU,FR,85025,46.9451858636,-1.1916392484,INSEE
85600,MONTAIGU VENDEE,FR,85146,46.9759800852,-1.31364530268,INSEE
85600,TREIZE SEPTIERS,FR,85295,46.9975586143,-1.23193361154,INSEE
85610,CUGAND,FR,85076,47.0602388146,-1.25289811103,INSEE
85610,LA BERNARDIERE,FR,85021,47.0361828072,-1.27390355206,INSEE
85620,ROCHESERVIERE,FR,85190,46.9274273036,-1.50132208111,INSEE
85630,BARBATRE,FR,85011,46.9335754783,-2.16743559847,INSEE
85640,MOUCHAMPS,FR,85153,46.7870550926,-1.05454102867,INSEE
85660,ST PHILBERT DE BOUAINE,FR,85262,46.9927907526,-1.5073882242,INSEE
85670,LA CHAPELLE PALLUAU,FR,85055,46.7873638997,-1.62492863273,INSEE
85670,FALLERON,FR,85086,46.8623928354,-1.70108938038,INSEE
85670,ST ETIENNE DU BOIS,FR,85210,46.8418481774,-1.59617737479,INSEE
85670,ST PAUL MONT PENIT,FR,85260,46.8070059547,-1.66964833149,INSEE
85670,ST CHRISTOPHE DU LIGNERON,FR,85204,46.8151386519,-1.74035413493,INSEE
85670,GRAND LANDES,FR,85102,46.8483283063,-1.64453002578,INSEE
85670,PALLUAU,FR,85169,46.8063002019,-1.60225256402,INSEE
85680,LA GUERINIERE,FR,85106,46.9669962053,-2.2302799245,INSEE
85690,NOTRE DAME DE MONTS,FR,85164,46.8424284611,-2.10928732775,INSEE
85700,SEVREMONT,FR,85090,46.8211105864,-0.854584153953,INSEE
85700,LA MEILLERAIE TILLAY,FR,85140,46.742582825,-0.85478763606,INSEE
85700,MONTOURNAIS,FR,85147,46.7502937556,-0.770013941158,INSEE
85700,POUZAUGES,FR,85182,46.7812581702,-0.828778359084,INSEE
85700,REAUMUR,FR,85187,46.7145137269,-0.816742537248,INSEE
85700,MENOMBLET,FR,85141,46.7301338667,-0.728654955878,INSEE
85700,ST MESMIN,FR,85254,46.8005779435,-0.748892533741,INSEE
85710,BOIS DE CENE,FR,85024,46.9479643351,-1.89668693466,INSEE
85710,CHATEAUNEUF,FR,85062,46.916944435,-1.9261131832,INSEE
85710,LA GARNACHE,FR,85096,46.8977541296,-1.82443040539,INSEE
85740,L EPINE,FR,85083,46.9843405667,-2.26449527608,INSEE
85750,ANGLES,FR,85004,46.3870511077,-1.40049386944,INSEE
85770,LES VELLUIRE SUR VENDEE,FR,85177,46.4190919441,-0.910475769222,INSEE
85770,VIX,FR,85303,46.3543018169,-0.856628326667,INSEE
85770,LE GUE DE VELLUIRE,FR,85105,46.3675950645,-0.905432724485,INSEE
85770,L ILE D ELLE,FR,85111,46.3334258655,-0.919100677098,INSEE
85800,ST GILLES CROIX DE VIE,FR,85222,46.6904708814,-1.91946363327,INSEE
85800,LE FENOUILLER,FR,85088,46.7161264566,-1.89206667498,INSEE
85800,GIVRAND,FR,85100,46.6822701061,-1.8787272243,INSEE
EOF;
public function getOrder()
{
return 50;
}
public static $refs = [];
public function load(ObjectManager $manager)
{
@@ -51,342 +337,40 @@ class LoadPostalCodes extends AbstractFixture implements OrderedFixtureInterface
$this->loadPostalCodeCSV($manager, self::$postalCodeFrance, 'FR');
}
private function loadPostalCodeCSV(ObjectManager $manager, string $csv, string $countryCode) {
private function loadPostalCodeCSV(ObjectManager $manager, string $csv, string $countryCode)
{
$lines = str_getcsv($csv, "\n");
$country = $manager->getRepository(Country::class)
->findOneBy(['countryCode' => $countryCode]);
foreach($lines as $line) {
$code = str_getcsv($line);
->findOneBy(['countryCode' => $countryCode]);
foreach ($lines as $line) {
$code = str_getcsv($line);
$c = new PostalCode();
$c->setCountry($country)
->setCode($code[0])
->setName(\ucwords(\strtolower($code[1])))
;
->setCode($code[0])
->setName(ucwords(strtolower($code[1])));
if (NULL != $code[3]){
if (null != $code[3]) {
$c->setRefPostalCodeId($code[3]);
}
if (NULL != $code[4] & NULL != $code[5]){
if (null != $code[4] & null != $code[5]) {
$c->setCenter(Point::fromLonLat((float) $code[5], (float) $code[4]));
}
if (NULL != $code[6]){
if (null != $code[6]) {
$c->setPostalCodeSource($code[6]);
}
$manager->persist($c);
$ref = 'postal_code_'.$code[0];
if (! $this->hasReference($ref)) {
$ref = 'postal_code_' . $code[0];
if (!$this->hasReference($ref)) {
$this->addReference($ref, $c);
self::$refs[] = $ref;
}
}
$manager->flush();
}
private static $postalCodeBelgium = <<<EOF
1000,BRUXELLES,BE
1020,BRUXELLES,BE
1030,SCHAERBEEK,BE
1040,ETTERBEEK,BE
1050,IXELLES,BE
1060,SAINT-GILLES,BE
1070,ANDERLECHT,BE
1080,MOLENBEEK-SAINT-JEAN,BE
1081,KOEKELBERG,BE
1082,BERCHEM-SAINTE-AGATHE,BE
1083,GANSHOREN,BE
1090,JETTE,BE
1120,BRUXELLES,BE
1130,BRUXELLES,BE
1140,EVERE,BE
1150,WOLUWE-SAINT-PIERRE,BE
1160,AUDERGHEM,BE
1170,WATERMAEL-BOITSFORT,BE
1180,UCCLE,BE
1190,FOREST,BE
1200,WOLUWE-SAINT-LAMBERT,BE
1210,SAINT-JOSSE-TEN-NOODE,BE
1300,WAVRE,BE
1300,WAVRE,BE
1301,WAVRE,BE
1310,LA HULPE,BE
1315,INCOURT,BE
1315,INCOURT,BE
1315,INCOURT,BE
1315,INCOURT,BE
1315,INCOURT,BE
1320,BEAUVECHAIN,BE
EOF;
private static $postalCodeFrance = <<<EOF
85000,LA ROCHE SUR YON,FR,85191,46.6675261644,-1.4077954093,INSEE
85000,MOUILLERON LE CAPTIF,FR,85155,46.7104764993,-1.46129661418,INSEE
85100,LES SABLES D OLONNE,FR,85194,46.5007612799,-1.79255128677,INSEE
85110,STE CECILE,FR,85202,46.7309688326,-1.12107316048,INSEE
85110,LA JAUDONNIERE,FR,85115,46.6488761831,-0.962477574588,INSEE
85110,ST GERMAIN DE PRINCAY,FR,85220,46.7356314659,-1.04299885081,INSEE
85110,MONSIREIGNE,FR,85145,46.7383480028,-0.931953130855,INSEE
85110,ST VINCENT STERLANGES,FR,85276,46.7397220689,-1.08371759277,INSEE
85110,SIGOURNAIS,FR,85282,46.7140097406,-0.98747730882,INSEE
85110,CHANTONNAY,FR,85051,46.6690167793,-1.04372588019,INSEE
85110,ST PROUANT,FR,85266,46.7502017421,-0.974504061491,INSEE
85120,LA CHAPELLE AUX LYS,FR,85053,46.6221916887,-0.642706103195,INSEE
85120,VOUVANT,FR,85305,46.5626835135,-0.764380170382,INSEE
85120,ANTIGNY,FR,85005,46.6191770822,-0.767030058653,INSEE
85120,ST MAURICE DES NOUES,FR,85251,46.5955876221,-0.724327725888,INSEE
85120,LOGE FOUGEREUSE,FR,85125,46.6180854641,-0.6899276733,INSEE
85120,LA TARDIERE,FR,85289,46.663737434,-0.727562430214,INSEE
85120,LA CHATAIGNERAIE,FR,85059,46.6416143401,-0.739561966419,INSEE
85120,ST HILAIRE DE VOUST,FR,85229,46.5914988312,-0.651486245674,INSEE
85120,BREUIL BARRET,FR,85037,46.6503266235,-0.671948654426,INSEE
85120,ST PIERRE DU CHEMIN,FR,85264,46.6957771744,-0.701777715154,INSEE
85130,LA GAUBRETIERE,FR,85097,46.9345007303,-1.05578200702,INSEE
85130,ST MARTIN DES TILLEULS,FR,85247,46.9711539531,-1.06282621567,INSEE
85130,TIFFAUGES,FR,85293,47.0020573556,-1.09858009203,INSEE
85130,CHANVERRIE,FR,85302,46.9634774521,-0.985340006089,INSEE
85130,BAZOGES EN PAILLERS,FR,85013,46.9213757643,-1.14415666313,INSEE
85130,LES LANDES GENUSSON,FR,85119,46.9663828627,-1.12900644447,INSEE
85130,ST AUBIN DES ORMEAUX,FR,85198,46.9958175597,-1.04216568722,INSEE
85140,ESSARTS EN BOCAGE,FR,85084,46.7806739038,-1.22925967851,INSEE
85140,LA MERLATIERE,FR,85142,46.7557703112,-1.29794577,INSEE
85140,ST MARTIN DES NOYERS,FR,85246,46.7239461187,-1.20379080965,INSEE
85140,CHAUCHE,FR,85064,46.8282791899,-1.27090860656,INSEE
85150,ST MATHURIN,FR,85250,46.5686332748,-1.70787622288,INSEE
85150,MARTINET,FR,85138,46.6620680463,-1.6772013304,INSEE
85150,STE FLAIVE DES LOUPS,FR,85211,46.611019489,-1.58031627863,INSEE
85150,STE FOY,FR,85214,46.5327600427,-1.69243074733,INSEE
85150,ST JULIEN DES LANDES,FR,85236,46.6395925444,-1.7159724914,INSEE
85150,ST GEORGES DE POINTINDOUX,FR,85218,46.6423470977,-1.62881823574,INSEE
85150,LE GIROUARD,FR,85099,46.5726064909,-1.58872487716,INSEE
85150,LANDERONDE,FR,85118,46.6549237031,-1.57351777893,INSEE
85150,LES ACHARDS,FR,85152,46.6163645636,-1.65038156849,INSEE
85150,VAIRE,FR,85298,46.6055340621,-1.74863672042,INSEE
85160,ST JEAN DE MONTS,FR,85234,46.8021968737,-2.04839789308,INSEE
85170,BELLEVIGNY,FR,85019,46.7756383534,-1.43313700054,INSEE
85170,LE POIRE SUR VIE,FR,85178,46.769919754,-1.50488626452,INSEE
85170,BEAUFOU,FR,85015,46.8191122027,-1.52479250801,INSEE
85170,DOMPIERRE SUR YON,FR,85081,46.7599858068,-1.37275519417,INSEE
85170,LES LUCS SUR BOULOGNE,FR,85129,46.8527299002,-1.48398928084,INSEE
85170,ST DENIS LA CHEVASSE,FR,85208,46.8325959261,-1.3830312677,INSEE
85180,LES SABLES D OLONNE,FR,85194,46.5007612799,-1.79255128677,INSEE
85190,AIZENAY,FR,85003,46.7384516809,-1.62702889721,INSEE
85190,VENANSAULT,FR,85300,46.685677363,-1.54112129191,INSEE
85190,MACHE,FR,85130,46.771364944,-1.69526445062,INSEE
85190,BEAULIEU SOUS LA ROCHE,FR,85016,46.6872087211,-1.62355064963,INSEE
85190,LA GENETOUZE,FR,85098,46.7244524541,-1.50410719693,INSEE
85200,PISSOTTE,FR,85176,46.5010870694,-0.808352236192,INSEE
85200,AUCHAY SUR VENDEE,FR,85009,46.4474386161,-0.876574265149,INSEE
85200,FONTENAY LE COMTE,FR,85092,46.4563186117,-0.793449510859,INSEE
85200,MERVENT,FR,85143,46.5325327351,-0.748519927998,INSEE
85200,DOIX LES FONTAINES,FR,85080,46.3849492327,-0.806840287485,INSEE
85200,LONGEVES,FR,85126,46.4722105292,-0.858917690239,INSEE
85200,ST MARTIN DE FRAIGNEAU,FR,85244,46.4289052087,-0.758948963227,INSEE
85200,SERIGNE,FR,85281,46.5054321828,-0.848819460581,INSEE
85200,BOURNEAU,FR,85033,46.5476882922,-0.813838020265,INSEE
85200,ST MICHEL LE CLOUCQ,FR,85256,46.4861591475,-0.743056336646,INSEE
85200,MONTREUIL,FR,85148,46.3973419593,-0.840846860992,INSEE
85200,L ORBRIE,FR,85167,46.4997145725,-0.77427886573,INSEE
85210,ST JEAN DE BEUGNE,FR,85233,46.5196817523,-1.10826075013,INSEE
85210,ST MARTIN LARS EN STE HERMINE,FR,85248,46.5970244335,-0.976384286709,INSEE
85210,LA REORTHE,FR,85188,46.6113748938,-1.04881036553,INSEE
85210,ST AUBIN LA PLAINE,FR,85199,46.5040293195,-1.06506577005,INSEE
85210,ST JUIRE CHAMPGILLON,FR,85235,46.5882648491,-1.00959676911,INSEE
85210,LA CHAPELLE THEMER,FR,85056,46.5639307793,-0.960376685588,INSEE
85210,ST ETIENNE DE BRILLOUET,FR,85209,46.5138850327,-1.01157660374,INSEE
85210,STE HERMINE,FR,85223,46.5572659953,-1.07210861039,INSEE
85210,THIRE,FR,85290,46.5433098199,-1.00699777534,INSEE
85220,ST MAIXENT SUR VIE,FR,85239,46.7329496925,-1.82595152879,INSEE
85220,LA CHAIZE GIRAUD,FR,85045,46.6476375058,-1.81865076161,INSEE
85220,LANDEVIEILLE,FR,85120,46.6444349925,-1.7854367847,INSEE
85220,L AIGUILLON SUR VIE,FR,85002,46.6706426618,-1.82599992318,INSEE
85220,COEX,FR,85070,46.7078707764,-1.75788339462,INSEE
85220,ST REVEREND,FR,85268,46.7057741864,-1.83155480996,INSEE
85220,APREMONT,FR,85006,46.7572682339,-1.74841313647,INSEE
85220,LA CHAPELLE HERMIER,FR,85054,46.6826679204,-1.72083372442,INSEE
85220,COMMEQUIERS,FR,85071,46.7674752232,-1.82534079642,INSEE
85230,BEAUVOIR SUR MER,FR,85018,46.9086155426,-2.06349351302,INSEE
85230,BOUIN,FR,85029,46.9815930867,-2.00423808381,INSEE
85230,ST URBAIN,FR,85273,46.8818371328,-2.01607828912,INSEE
85230,ST GERVAIS,FR,85221,46.9285711589,-1.98059327519,INSEE
85240,MARILLET,FR,85136,46.5667525381,-0.634287713939,INSEE
85240,ST HILAIRE DES LOGES,FR,85227,46.4747117878,-0.650611151998,INSEE
85240,FAYMOREAU,FR,85087,46.5427361252,-0.624271378946,INSEE
85240,XANTON CHASSENON,FR,85306,46.4519408659,-0.706316598666,INSEE
85240,FOUSSAIS PAYRE,FR,85094,46.5230750581,-0.687135962627,INSEE
85240,RIVES D AUTISE,FR,85162,46.424726987,-0.665995249042,INSEE
85240,PUY DE SERRE,FR,85184,46.5650384637,-0.680144631346,INSEE
85250,ST ANDRE GOULE D OIE,FR,85196,46.8410224478,-1.19644211396,INSEE
85250,LA RABATELIERE,FR,85186,46.8584147661,-1.2569733759,INSEE
85250,CHAVAGNES EN PAILLERS,FR,85065,46.8951394423,-1.24054768713,INSEE
85250,ST FULGENT,FR,85215,46.8705618525,-1.16246465678,INSEE
85250,VENDRENNES,FR,85301,46.8226741756,-1.11650982164,INSEE
85260,LA COPECHAGNIERE,FR,85072,46.8523980181,-1.34349746898,INSEE
85260,L HERBERGEMENT,FR,85108,46.9166207979,-1.37033557148,INSEE
85260,MONTREVERD,FR,85197,46.9277672307,-1.4126154924,INSEE
85260,LES BROUZILS,FR,85038,46.8854235235,-1.33186892233,INSEE
85270,NOTRE DAME DE RIEZ,FR,85189,46.7532179022,-1.8935292542,INSEE
85270,ST HILAIRE DE RIEZ,FR,85226,46.7432732188,-1.96439228965,INSEE
85280,LA FERRIERE,FR,85089,46.7215872927,-1.33469332327,INSEE
85290,MORTAGNE SUR SEVRE,FR,85151,46.9910941319,-0.946500033344,INSEE
85290,ST LAURENT SUR SEVRE,FR,85238,46.9506837971,-0.901123752328,INSEE
85300,CHALLANS,FR,85047,46.8354416653,-1.84036683139,INSEE
85300,FROIDFOND,FR,85095,46.8789464367,-1.75511438567,INSEE
85300,SOULLANS,FR,85284,46.7951288466,-1.91392699457,INSEE
85300,LE PERRIER,FR,85172,46.8196487652,-1.97926629071,INSEE
85300,SALLERTAINE,FR,85280,46.8659054157,-1.94894081389,INSEE
85310,LA CHAIZE LE VICOMTE,FR,85046,46.6729533879,-1.29188591019,INSEE
85310,NESMY,FR,85160,46.5921936479,-1.40947698594,INSEE
85310,RIVES DE L YON,FR,85213,46.605637391,-1.3354497172,INSEE
85310,LE TABLIER,FR,85285,46.5596307281,-1.32788759657,INSEE
85320,CHATEAU GUIBERT,FR,85061,46.5741109302,-1.25524886228,INSEE
85320,LES PINEAUX,FR,85175,46.599225902,-1.17865799724,INSEE
85320,ROSNAY,FR,85193,46.5324344973,-1.3007139449,INSEE
85320,BESSAY,FR,85023,46.5397253861,-1.17028433093,INSEE
85320,LA BRETONNIERE LA CLAYE,FR,85036,46.4879459421,-1.26773426545,INSEE
85320,CORPE,FR,85073,46.5050234767,-1.17034425311,INSEE
85320,MAREUIL SUR LAY DISSAIS,FR,85135,46.5335825488,-1.22688907859,INSEE
85320,PEAULT,FR,85171,46.502029199,-1.22708559855,INSEE
85320,LA COUTURE,FR,85074,46.523938732,-1.26493227292,INSEE
85320,MOUTIERS SUR LE LAY,FR,85157,46.5651677306,-1.16826489836,INSEE
85320,STE PEXINE,FR,85261,46.5596018797,-1.12406235901,INSEE
85330,NOIRMOUTIER EN L ILE,FR,85163,47.0086655085,-2.26243620205,INSEE
85340,L ILE D OLONNE,FR,85112,46.570163703,-1.7737502368,INSEE
85340,LES SABLES D OLONNE,FR,85194,46.5007612799,-1.79255128677,INSEE
85350,L ILE D YEU,FR,85113,46.7093514816,-2.34712702345,INSEE
85360,LA TRANCHE SUR MER,FR,85294,46.3564601605,-1.43136322126,INSEE
85370,MOUZEUIL ST MARTIN,FR,85158,46.4591118412,-0.984449849889,INSEE
85370,NALLIERS,FR,85159,46.4658962703,-1.03958611312,INSEE
85370,LE LANGON,FR,85121,46.4393119039,-0.947017086151,INSEE
85390,BAZOGES EN PAREDS,FR,85014,46.6602005512,-0.914053446792,INSEE
85390,ST MAURICE LE GIRARD,FR,85252,46.6398624578,-0.810875649028,INSEE
85390,TALLUD STE GEMME,FR,85287,46.6949386862,-0.886169517112,INSEE
85390,CHAVAGNES LES REDOUX,FR,85066,46.7101499475,-0.915900131393,INSEE
85390,CHEFFOIS,FR,85067,46.6786935635,-0.782949851125,INSEE
85390,MOUILLERON ST GERMAIN,FR,85154,46.6612700667,-0.846784201071,INSEE
85400,STE GEMME LA PLAINE,FR,85216,46.4732196212,-1.11103084694,INSEE
85400,LAIROUX,FR,85117,46.4496842668,-1.27114022202,INSEE
85400,LUCON,FR,85128,46.4510564854,-1.16449285012,INSEE
85400,LES MAGNILS REIGNIERS,FR,85131,46.4635045649,-1.210635375,INSEE
85400,CHASNAIS,FR,85058,46.4459908481,-1.2385924923,INSEE
85410,ST LAURENT DE LA SALLE,FR,85237,46.5854041653,-0.922177315485,INSEE
85410,LA CAILLERE ST HILAIRE,FR,85040,46.6293907412,-0.933153931505,INSEE
85410,ST CYR DES GATS,FR,85205,46.572397925,-0.86344873853,INSEE
85410,THOUARSAIS BOUILDROUX,FR,85292,46.6062740621,-0.873461023865,INSEE
85410,CEZAIS,FR,85041,46.5917363748,-0.802618133558,INSEE
85410,ST SULPICE EN PAREDS,FR,85271,46.6130038733,-0.8310839288,INSEE
85420,LE MAZEAU,FR,85139,46.3298580373,-0.672957405035,INSEE
85420,LIEZ,FR,85123,46.3698532376,-0.70502476758,INSEE
85420,BOUILLE COURDAULT,FR,85028,46.3847932448,-0.684917815779,INSEE
85420,DAMVIX,FR,85078,46.32063079,-0.743504259797,INSEE
85420,MAILLE,FR,85132,46.3417503082,-0.787487297301,INSEE
85420,ST PIERRE LE VIEUX,FR,85265,46.4009643491,-0.742816267425,INSEE
85420,ST SIGISMOND,FR,85269,46.3368577973,-0.707293731101,INSEE
85420,MAILLEZAIS,FR,85133,46.3642178261,-0.750260780443,INSEE
85420,RIVES D AUTISE,FR,85162,46.424726987,-0.665995249042,INSEE
85430,AUBIGNY LES CLOUZEAUX,FR,85008,46.6028241769,-1.46743549114,INSEE
85430,NIEUL LE DOLENT,FR,85161,46.5676509922,-1.51560194548,INSEE
85430,LA BOISSIERE DES LANDES,FR,85026,46.5581861734,-1.44371985689,INSEE
85440,ST HILAIRE LA FORET,FR,85231,46.4551155186,-1.53048160541,INSEE
85440,TALMONT ST HILAIRE,FR,85288,46.475786445,-1.62751498166,INSEE
85440,POIROUX,FR,85179,46.5107890457,-1.53929317556,INSEE
85440,GROSBREUIL,FR,85103,46.5390090882,-1.6072005484,INSEE
85440,AVRILLE,FR,85010,46.4744272125,-1.49524360118,INSEE
85450,CHAMPAGNE LES MARAIS,FR,85049,46.3735020647,-1.13380723653,INSEE
85450,LA TAILLEE,FR,85286,46.3852513569,-0.941017792066,INSEE
85450,CHAILLE LES MARAIS,FR,85042,46.3853555319,-1.01044079362,INSEE
85450,VOUILLE LES MARAIS,FR,85304,46.3891941167,-0.968106001439,INSEE
85450,MOREILLES,FR,85149,46.4218721314,-1.09404530407,INSEE
85450,PUYRAVAULT,FR,85185,46.3653834101,-1.09115660367,INSEE
85450,STE RADEGONDE DES NOYERS,FR,85267,46.3694246909,-1.06671995264,INSEE
85460,LA FAUTE SUR MER,FR,85307,46.3199919131,-1.31487049579,INSEE
85460,L AIGUILLON SUR MER,FR,85001,46.304138479,-1.2623239198,INSEE
85470,BRETIGNOLLES SUR MER,FR,85035,46.6374826705,-1.86324200464,INSEE
85470,BREM SUR MER,FR,85243,46.6118566989,-1.81003917923,INSEE
85480,BOURNEZEAU,FR,85034,46.6296975315,-1.14101742229,INSEE
85480,FOUGERE,FR,85093,46.6617881911,-1.23612691916,INSEE
85480,ST HILAIRE LE VOUHIS,FR,85232,46.6859198669,-1.15222590884,INSEE
85480,THORIGNY,FR,85291,46.6179795025,-1.24888057642,INSEE
85490,BENET,FR,85020,46.368873213,-0.613959918706,INSEE
85500,BEAUREPAIRE,FR,85017,46.9050210355,-1.10144867013,INSEE
85500,ST PAUL EN PAREDS,FR,85259,46.8303789022,-0.964515191283,INSEE
85500,LES HERBIERS,FR,85109,46.8666125813,-1.02216086186,INSEE
85500,MESNARD LA BAROTIERE,FR,85144,46.851716793,-1.10954466033,INSEE
85500,CHANVERRIE,FR,85302,46.9634774521,-0.985340006089,INSEE
85510,ROCHETREJOUX,FR,85192,46.7852546732,-0.996743019108,INSEE
85510,LE BOUPERE,FR,85031,46.7877960262,-0.930897406714,INSEE
85520,JARD SUR MER,FR,85114,46.4246376808,-1.60014921643,INSEE
85520,ST VINCENT SUR JARD,FR,85278,46.4297504489,-1.54956205778,INSEE
85530,LA BRUFFIERE,FR,85039,47.0148006973,-1.18329758318,INSEE
85540,LE CHAMP ST PERE,FR,85050,46.5157210212,-1.33946630196,INSEE
85540,LE GIVRE,FR,85101,46.4729146043,-1.40256149118,INSEE
85540,MOUTIERS LES MAUXFAITS,FR,85156,46.489279204,-1.43622387207,INSEE
85540,ST VINCENT SUR GRAON,FR,85277,46.5034756656,-1.382954206,INSEE
85540,LA JONCHERE,FR,85116,46.4358647401,-1.38517843312,INSEE
85540,ST BENOIST SUR MER,FR,85201,46.4266286403,-1.3399129604,INSEE
85540,CURZON,FR,85077,46.4512376923,-1.30138059216,INSEE
85540,ST AVAUGOURD DES LANDES,FR,85200,46.5136722903,-1.47528120789,INSEE
85540,ST CYR EN TALMONDAIS,FR,85206,46.4597334032,-1.33722144355,INSEE
85550,LA BARRE DE MONTS,FR,85012,46.8722784154,-2.09984018879,INSEE
85560,LE BERNARD,FR,85022,46.44832528,-1.43979865314,INSEE
85560,LONGEVILLE SUR MER,FR,85127,46.4091029013,-1.47711855345,INSEE
85570,POUILLE,FR,85181,46.5022256779,-0.955223380119,INSEE
85570,ST VALERIEN,FR,85274,46.5348508899,-0.944470507825,INSEE
85570,L HERMENAULT,FR,85110,46.5156262822,-0.898430664265,INSEE
85570,PETOSSE,FR,85174,46.4796848965,-0.911734176662,INSEE
85570,ST MARTIN DES FONTAINES,FR,85245,46.5464637508,-0.907394581139,INSEE
85570,MARSAIS STE RADEGONDE,FR,85137,46.5380790745,-0.868868309437,INSEE
85580,ST DENIS DU PAYRE,FR,85207,46.4118936776,-1.27222282402,INSEE
85580,ST MICHEL EN L HERM,FR,85255,46.3366903175,-1.2483968538,INSEE
85580,TRIAIZE,FR,85297,46.3792685111,-1.19928351422,INSEE
85580,GRUES,FR,85104,46.3813091348,-1.32364519268,INSEE
85590,TREIZE VENTS,FR,85296,46.9168130123,-0.845959158017,INSEE
85590,LES EPESSES,FR,85082,46.8917166066,-0.903422756546,INSEE
85590,MALLIEVRE,FR,85134,46.9112847287,-0.864977836096,INSEE
85590,ST MALO DU BOIS,FR,85240,46.9248120291,-0.914182961099,INSEE
85590,ST MARS LA REORTHE,FR,85242,46.8597253005,-0.925777900202,INSEE
85600,LA BOISSIERE DE MONTAIGU,FR,85025,46.9451858636,-1.1916392484,INSEE
85600,MONTAIGU VENDEE,FR,85146,46.9759800852,-1.31364530268,INSEE
85600,TREIZE SEPTIERS,FR,85295,46.9975586143,-1.23193361154,INSEE
85610,CUGAND,FR,85076,47.0602388146,-1.25289811103,INSEE
85610,LA BERNARDIERE,FR,85021,47.0361828072,-1.27390355206,INSEE
85620,ROCHESERVIERE,FR,85190,46.9274273036,-1.50132208111,INSEE
85630,BARBATRE,FR,85011,46.9335754783,-2.16743559847,INSEE
85640,MOUCHAMPS,FR,85153,46.7870550926,-1.05454102867,INSEE
85660,ST PHILBERT DE BOUAINE,FR,85262,46.9927907526,-1.5073882242,INSEE
85670,LA CHAPELLE PALLUAU,FR,85055,46.7873638997,-1.62492863273,INSEE
85670,FALLERON,FR,85086,46.8623928354,-1.70108938038,INSEE
85670,ST ETIENNE DU BOIS,FR,85210,46.8418481774,-1.59617737479,INSEE
85670,ST PAUL MONT PENIT,FR,85260,46.8070059547,-1.66964833149,INSEE
85670,ST CHRISTOPHE DU LIGNERON,FR,85204,46.8151386519,-1.74035413493,INSEE
85670,GRAND LANDES,FR,85102,46.8483283063,-1.64453002578,INSEE
85670,PALLUAU,FR,85169,46.8063002019,-1.60225256402,INSEE
85680,LA GUERINIERE,FR,85106,46.9669962053,-2.2302799245,INSEE
85690,NOTRE DAME DE MONTS,FR,85164,46.8424284611,-2.10928732775,INSEE
85700,SEVREMONT,FR,85090,46.8211105864,-0.854584153953,INSEE
85700,LA MEILLERAIE TILLAY,FR,85140,46.742582825,-0.85478763606,INSEE
85700,MONTOURNAIS,FR,85147,46.7502937556,-0.770013941158,INSEE
85700,POUZAUGES,FR,85182,46.7812581702,-0.828778359084,INSEE
85700,REAUMUR,FR,85187,46.7145137269,-0.816742537248,INSEE
85700,MENOMBLET,FR,85141,46.7301338667,-0.728654955878,INSEE
85700,ST MESMIN,FR,85254,46.8005779435,-0.748892533741,INSEE
85710,BOIS DE CENE,FR,85024,46.9479643351,-1.89668693466,INSEE
85710,CHATEAUNEUF,FR,85062,46.916944435,-1.9261131832,INSEE
85710,LA GARNACHE,FR,85096,46.8977541296,-1.82443040539,INSEE
85740,L EPINE,FR,85083,46.9843405667,-2.26449527608,INSEE
85750,ANGLES,FR,85004,46.3870511077,-1.40049386944,INSEE
85770,LES VELLUIRE SUR VENDEE,FR,85177,46.4190919441,-0.910475769222,INSEE
85770,VIX,FR,85303,46.3543018169,-0.856628326667,INSEE
85770,LE GUE DE VELLUIRE,FR,85105,46.3675950645,-0.905432724485,INSEE
85770,L ILE D ELLE,FR,85111,46.3334258655,-0.919100677098,INSEE
85800,ST GILLES CROIX DE VIE,FR,85222,46.6904708814,-1.91946363327,INSEE
85800,LE FENOUILLER,FR,85088,46.7161264566,-1.89206667498,INSEE
85800,GIVRAND,FR,85100,46.6822701061,-1.8787272243,INSEE
EOF;
}

View File

@@ -1,86 +1,67 @@
<?php
/*
* Chill is a suite of a modules, Chill is a software for social workers
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\MainBundle\DataFixtures\ORM;
use Chill\MainBundle\Entity\RoleScope;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Persistence\ObjectManager;
use Chill\MainBundle\Entity\RoleScope;
use Chill\MainBundle\DataFixtures\ORM\LoadScopes;
/**
*
*
* @author Julien Fastré <julien.fastre@champs-libres.coop>
*/
class LoadRoleScopes extends AbstractFixture implements OrderedFixtureInterface
{
public static $permissions = [
'CHILL_FOO_SEE' => [
'names' => [
'fr' => 'voir foo',
'en' => 'see foo',
'nl' => 'zie foo',
],
],
'CHILL_FOO_SEE_DETAILS' => [
'names' => [
'fr' => 'voir foo avec détails',
'en' => 'see foo with details',
'nl' => 'zie foo in details',
],
],
'CHILL_FOO_EDIT' => [
'names' => [
'fr' => 'modifier foo',
'en' => 'edit foo',
'nl' => 'editie foo',
],
],
];
public static $references = [];
public function getOrder()
{
return 300;
}
public static $permissions = array(
'CHILL_FOO_SEE' => array(
'names' => array(
'fr' => 'voir foo',
'en' => 'see foo',
'nl' => 'zie foo'
)
),
'CHILL_FOO_SEE_DETAILS' => array(
'names' => array(
'fr' => 'voir foo avec détails',
'en' => 'see foo with details',
'nl' => 'zie foo in details'
)
),
'CHILL_FOO_EDIT' => array(
'names' => array(
'fr' => 'modifier foo',
'en' => 'edit foo',
'nl' => 'editie foo'
)
)
);
public static $references = array();
public function load(ObjectManager $manager)
{
foreach (static::$permissions as $key => $permission) {
foreach(LoadScopes::$references as $scopeReference) {
foreach (LoadScopes::$references as $scopeReference) {
$roleScope = new RoleScope();
$roleScope->setRole($key)
->setScope($this->getReference($scopeReference))
;
$reference = 'role_scope_'.$key.'_'.$this->getReference($scopeReference)->getName()['en'];
echo "Creating $reference \n";
->setScope($this->getReference($scopeReference));
$reference = 'role_scope_' . $key . '_' . $this->getReference($scopeReference)->getName()['en'];
echo "Creating {$reference} \n";
$this->addReference($reference, $roleScope);
$manager->persist($roleScope);
static::$references[] = $reference;
}
}
$manager->flush();
}
}

View File

@@ -1,21 +1,10 @@
<?php
/*
* Chill is a suite of a modules, Chill is a software for social workers
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\MainBundle\DataFixtures\ORM;
@@ -25,55 +14,53 @@ use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Persistence\ObjectManager;
/**
* Create scopes
*
* @author Julien Fastré <julien.fastre@champs-libres.coop>
* Create scopes.
*/
class LoadScopes extends AbstractFixture implements OrderedFixtureInterface
{
public static $references = [];
public $scopes = [
[
'names' => [
'fr' => 'tous',
'en' => 'all',
'nl' => 'algemeen',
],
],
[
'names' => [
'fr' => 'social',
'en' => 'social',
'nl' => 'sociaal',
],
],
[
'names' => [
'fr' => 'administratif',
'en' => 'administrative',
'nl' => 'administratief',
],
],
];
public function getOrder()
{
return 200;
}
public $scopes = array(
array(
'names' => array(
'fr' => 'tous',
'en' => 'all',
'nl' => 'algemeen'
),
),
array(
'names' => array(
'fr' => 'social',
'en' => 'social',
'nl' => 'sociaal'
)
),
array(
'names' => array(
'fr' => 'administratif',
'en' => 'administrative',
'nl' => 'administratief'
)
)
);
public static $references = array();
public function load(ObjectManager $manager)
{
{
foreach ($this->scopes as $new) {
$scope = new \Chill\MainBundle\Entity\Scope();
$scope->setName($new['names']);
$manager->persist($scope);
$reference = 'scope_'.$new['names']['en'];
$reference = 'scope_' . $new['names']['en'];
$this->addReference($reference, $scope);
static::$references[] = $reference;
}
$manager->flush();
}
}

View File

@@ -1,30 +1,59 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\MainBundle\DataFixtures\ORM;
use Chill\MainBundle\Entity\User;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Persistence\ObjectManager;
use Symfony\Component\DependencyInjection\ContainerInterface;
use LogicException;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Chill\MainBundle\DataFixtures\ORM\LoadCenters;
use Chill\MainBundle\DataFixtures\ORM\LoadPermissionsGroup;
use Chill\MainBundle\Entity\User;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Security\Core\Encoder\EncoderFactory;
use Symfony\Component\Security\Core\Encoder\MessageDigestPasswordEncoder;
use function str_replace;
/**
* Load fixtures users into database
* Load fixtures users into database.
*
* create a user for each permission_group and center.
* username and password are identicals.
*
* @author Julien Fastré <julien.fastre@champs-libres.coop>
*/
class LoadUsers extends AbstractFixture implements OrderedFixtureInterface, ContainerAwareInterface
{
public static $refs = [
'center a_social' => [
'groupCenterRefs' => ['centerA_permission_group_social'],
],
'center a_administrative' => [
'groupCenterRefs' => ['centerA_permission_group_administrative'],
],
'center a_direction' => [
'groupCenterRefs' => ['centerA_permission_group_direction'],
],
'center b_social' => [
'groupCenterRefs' => ['centerB_permission_group_social'],
],
'center b_administrative' => [
'groupCenterRefs' => ['centerB_permission_group_administrative'],
],
'center b_direction' => [
'groupCenterRefs' => ['centerB_permission_group_direction'],
],
'multi_center' => [
'groupCenterRefs' => ['centerA_permission_group_social',
'centerB_permission_group_social', ],
],
];
/**
*
* @var ContainerInterface
*/
private $container;
@@ -34,58 +63,31 @@ class LoadUsers extends AbstractFixture implements OrderedFixtureInterface, Cont
return 1000;
}
public static $refs = array(
'center a_social' => array(
'groupCenterRefs' => ['centerA_permission_group_social']
),
'center a_administrative' => array(
'groupCenterRefs' => ['centerA_permission_group_administrative']
),
'center a_direction' => array(
'groupCenterRefs' => ['centerA_permission_group_direction']
),
'center b_social' => array(
'groupCenterRefs' => ['centerB_permission_group_social']
),
'center b_administrative' => array(
'groupCenterRefs' => ['centerB_permission_group_administrative']
),
'center b_direction' => array(
'groupCenterRefs' => ['centerB_permission_group_direction']
),
'multi_center' => array(
'groupCenterRefs' => ['centerA_permission_group_social',
'centerB_permission_group_social']
)
);
public function load(ObjectManager $manager)
{
foreach (self::$refs as $username => $params) {
$user = new User();
$defaultEncoder = new MessageDigestPasswordEncoder('sha512', true, 5000);
$encoderFactory = new EncoderFactory([
User::class => $defaultEncoder
User::class => $defaultEncoder,
]);
$user
->setUsername($username)
->setPassword($encoderFactory
->getEncoder($user)
->encodePassword('password', $user->getSalt())
)
->setEmail(sprintf("%s@chill.social", \str_replace(' ', '', $username)))
;
->setPassword(
$encoderFactory
->getEncoder($user)
->encodePassword('password', $user->getSalt())
)
->setEmail(sprintf('%s@chill.social', str_replace(' ', '', $username)));
foreach ($params['groupCenterRefs'] as $groupCenterRef) {
$user->addGroupCenter($this->getReference($groupCenterRef));
}
echo 'Creating user ' . $username ."... \n";
echo 'Creating user ' . $username . "... \n";
$manager->persist($user);
$this->addReference($username, $user);
}
@@ -93,13 +95,12 @@ class LoadUsers extends AbstractFixture implements OrderedFixtureInterface, Cont
$manager->flush();
}
public function setContainer(ContainerInterface $container = null)
public function setContainer(?ContainerInterface $container = null)
{
if (NULL === $container) {
throw new \LogicException('$container should not be null');
if (null === $container) {
throw new LogicException('$container should not be null');
}
$this->container = $container;
}
}