1 <?php
declare(strict_types
=1);
4 * This file is part of the Rapsys AirBundle package.
6 * (c) Raphaël Gertz <symfony@rapsys.eu>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Rapsys\AirBundle\DataFixtures
;
14 use Doctrine\Bundle\FixturesBundle\Fixture
;
15 use Doctrine\Persistence\ObjectManager
;
16 use Symfony\Component\DependencyInjection\ContainerInterface
;
17 use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface
;
19 use Rapsys\AirBundle\Entity\Civility
;
20 use Rapsys\AirBundle\Entity\Group
;
21 use Rapsys\AirBundle\Entity\User
;
22 use Rapsys\AirBundle\Entity\Location
;
23 use Rapsys\AirBundle\Entity\Slot
;
28 class AirFixtures
extends Fixture
{
30 * Air fixtures constructor
32 public function __construct(protected ContainerInterface
$container, protected UserPasswordHasherInterface
$hasher) {
38 public function load(ObjectManager
$manager) {
48 foreach($civilityTree as $civilityData) {
49 $civility = new Civility($civilityData);
50 $manager->persist($civility);
51 $civilitys[$civilityData] = $civility;
55 //TODO: insert countries from https://raw.githubusercontent.com/raramuridesign/mysql-country-list/master/country-lists/mysql-country-list-detailed-info.sql
56 #CREATE TABLE `countries` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `code` varchar(2) NOT NULL, `alpha` varchar(3) NOT NULL, `title` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL, `created` datetime NOT NULL, `updated` datetime NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `code` (`code`), UNIQUE KEY `alpha` (`alpha`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
57 #insert into countries (code, alpha, title, created, updated) select countryCode, isoAlpha3, countryName, NOW(), NOW() FROM apps_countries_detailed ORDER BY countryCode ASC, isoAlpha3 ASC;
61 'Argentine Tango' => [
72 foreach($danceTree as $danceTitle => $danceData) {
73 foreach($danceData as $danceType) {
74 $dance = new Dance($danceTitle, $danceType);
75 $manager->persist($dance);
91 foreach($letterTree as $letterTitle) {
92 $letter = new Letter($letterTitle);
93 $manager->persist($letter);
98 //XXX: ROLE_XXX is required by
109 foreach($groupTree as $groupData) {
110 $group = new Group($groupData);
111 $manager->persist($group);
112 $groups[$groupData] = $group;
116 //Flush to get the ids
124 'mail' => 'tango@rapsys.eu',
125 'pseudonym' => 'Milonga Raphaël',
126 'forename' => 'Raphaël',
127 'surname' => 'Gertz',
128 'phone' => '+33677952829',
134 'mail' => 'denis.courvoisier@wanadoo.fr',
135 'pseudonym' => 'DJ Sined',
136 'forename' => 'Denis',
137 'surname' => 'Courvoisier',
138 'phone' => '+33600000000',
144 'mail' => 'rannou402@orange.fr',
145 'pseudonym' => 'Trio Tango',
146 'forename' => 'Michel',
147 'surname' => 'Rannou',
148 'phone' => '+33600000000',
153 'group' => 'Regular',
154 'mail' => 'roxmaps@gmail.com',
155 'pseudonym' => 'Roxana',
156 'forename' => 'Roxana',
157 'surname' => 'Prado',
158 'phone' => '+33600000000',
165 foreach($userTree as $userData) {
166 $user = new User($userData['mail'], $userData['password'], $civilitys[$userData['short']], $userData['forename'], $userData['surname']);
167 #TODO: check that password is hashed correctly !!!
168 #$user->setPassword($this->hasher->hashPassword($user, $userData['password']));
169 $user->setPseudonym($userData['pseudonym']);
170 $user->setPhone($userData['phone']);
171 $user->addGroup($groups[$userData['group']]);
172 $manager->persist($user);
177 //Flush to get the ids
181 //XXX: adding a new zipcode here requires matching accuweather uris in Command/WeatherCommand.php
182 //TODO: add descriptions as well
185 'title' => 'Garnier opera',
186 'short' => 'Garnier',
187 'address' => '10 Place de l\'Opéra',
188 'zipcode' => '75009',
190 'latitude' => 48.871268,
191 'longitude' => 2.331832,
196 'title' => 'Tino-Rossi garden',
198 'address' => '2 Quai Saint-Bernard',
199 'zipcode' => '75005',
201 'latitude' => 48.847736,
202 'longitude' => 2.360953,
207 'title' => 'Trocadero esplanade',
208 'short' => 'Trocadero',
209 'address' => '1 Avenue Hussein 1er de Jordanie',
210 #75016 pour meteo-france, accuweather supporte 75116
211 'zipcode' => '75116',
213 'latitude' => 48.861888,
214 'longitude' => 2.288853,
219 'title' => 'Colette place',
220 'short' => 'Colette',
221 'address' => 'Galerie du Théâtre Français',
222 'zipcode' => '75001',
224 'latitude' => 48.863219,
225 'longitude' => 2.335847,
230 'title' => 'Swan island',
232 'address' => 'Allée des Cygnes',
233 'zipcode' => '75015',
235 'latitude' => 48.849976, #48.849976
236 'longitude' => 2.279603, #2.2796029,
241 'title' => 'Jussieu esplanade',
242 'short' => 'Jussieu',
243 'address' => '25 rue des Fossés Saint-Bernard',
244 'zipcode' => '75005',
246 'latitude' => 48.847955, #48.8479548
247 'longitude' => 2.353291, #2.3532907,
252 'title' => 'Orleans gallery',
253 'short' => 'Orleans',
254 'address' => '8 Galerie du Jardin',
255 'zipcode' => '75001',
257 'latitude' => 48.863885,
258 'longitude' => 2.337387,
263 'title' => 'Orsay museum',
265 'address' => '1 rue de la Légion d\'Honneur',
266 'zipcode' => '75007',
268 'latitude' => 48.860418,
269 'longitude' => 2.325815,
274 'title' => 'Saint-Honore market',
276 'address' => '1 Passage des Jacobins',
277 'zipcode' => '75001',
279 'latitude' => 48.866992,
280 'longitude' => 2.331752,
285 'title' => 'Igor Stravinsky place',
286 'short' => 'Stravinsky',
287 'address' => '2 rue Brisemiche',
288 'zipcode' => '75004',
290 'latitude' => 48.859244,
291 'longitude' => 2.351289,
296 'title' => 'Tokyo palace',
298 'address' => '14 Avenue de New York',
299 'zipcode' => '75116',
301 'latitude' => 48.863827,
302 'longitude' => 2.297339,
307 'title' => 'Drawings\' garden',
308 'short' => 'Villette',
309 'address' => 'Allée du Belvédère',
310 'zipcode' => '75019',
312 'latitude' => 48.892503,
313 'longitude' => 2.389300,
318 'title' => 'Louvre palace',
320 'address' => 'Quai François Mitterrand',
321 'zipcode' => '75001',
323 'latitude' => 48.860386,
324 'longitude' => 2.332611,
329 'title' => 'Monde garden',
330 'address' => '63 avenue Pierre Mendès-France',
331 'zipcode' => '75013',
333 'latitude' => 48.840451,
334 'longitude' => 2.367638,
342 foreach($locationTree as $locationData) {
343 $location = new Location($locationData['title'], $locationData['address'], $locationData['zipcode'], $locationData['city'], $locationData['latitude'], $locationData['longitude'], $locationData['hotspot'], $locationData['indoor']);
344 $manager->persist($location);
345 $locations[$locationData['title']] = $location;
349 //Flush to get the ids
362 foreach($slotTree as $slotData) {
363 $slot = new Slot($slotData);
364 $manager->persist($slot);
365 $slots[$slot->getId()] = $slot;
369 //Flush to get the ids