From 8962c1c05f921dec21b983295d048ded78f9d4bc Mon Sep 17 00:00:00 2001 From: nobohan Date: Wed, 20 Oct 2021 21:46:16 +0200 Subject: [PATCH] add fixture for location type --- .../DataFixtures/ORM/LoadLocationType.php | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadLocationType.php diff --git a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadLocationType.php b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadLocationType.php new file mode 100644 index 000000000..5ad32168f --- /dev/null +++ b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadLocationType.php @@ -0,0 +1,68 @@ +container = $container; + } + + public function getOrder() { + return 52; + } + + public function load(ObjectManager $manager): void { + + echo "loading some location type... \n"; + + $arr = [ + [ + 'name' => ['fr' => 'Mairie'], + 'address_required' => LocationType::STATUS_OPTIONAL + ], + [ + 'name' => ['fr' => 'Guichet d\'accueil'], + 'address_required' => LocationType::STATUS_OPTIONAL + ], + [ + 'name' => ['fr' => 'Domicile de l\'usager'], + 'address_required' => LocationType::STATUS_REQUIRED + ], + [ + 'name' => ['fr' => 'Centre d\'aide sociale'], + 'address_required' => LocationType::STATUS_OPTIONAL + ], + ]; + + foreach ($arr as $a) { + $locationType = (new LocationType()) + ->setTitle($a['name']) + ->setAvailableForUsers(True) + ->setAddressRequired($a['address_required']); + $manager->persist($locationType); + } + + $manager->flush(); + } +} \ No newline at end of file