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' => [ 
  62                            'Milonga', 'Class and milonga', 'Public class', 'Private class' 
  68                 foreach($danceTree as $danceTitle => $danceData) { 
  69                         foreach($danceData as $danceType) { 
  70                                 $dance = new Dance($danceTitle, $danceType); 
  71                                 $manager->persist($dance); 
  77                 //XXX: ROLE_XXX is required by 
  88                 foreach($groupTree as $groupData) { 
  89                         $group = new Group($groupData); 
  90                         $manager->persist($group); 
  91                         $groups[$groupData] = $group; 
  95                 //Flush to get the ids 
 103                                 'mail' => 'tango@rapsys.eu', 
 104                                 'pseudonym' => 'Milonga Raphaël', 
 105                                 'forename' => 'Raphaël', 
 106                                 'surname' => 'Gertz', 
 107                                 'phone' => '+33677952829', 
 113                                 'mail' => 'denis.courvoisier@wanadoo.fr', 
 114                                 'pseudonym' => 'DJ Sined', 
 115                                 'forename' => 'Denis', 
 116                                 'surname' => 'Courvoisier', 
 117                                 'phone' => '+33600000000', 
 123                                 'mail' => 'rannou402@orange.fr', 
 124                                 'pseudonym' => 'Trio Tango', 
 125                                 'forename' => 'Michel', 
 126                                 'surname' => 'Rannou', 
 127                                 'phone' => '+33600000000', 
 132                                 'group' => 'Regular', 
 133                                 'mail' => 'roxmaps@gmail.com', 
 134                                 'pseudonym' => 'Roxana', 
 135                                 'forename' => 'Roxana', 
 136                                 'surname' => 'Prado', 
 137                                 'phone' => '+33600000000', 
 144                 foreach($userTree as $userData) { 
 145                         $user = new User($userData['mail'], $userData['password'], $civilitys[$userData['short']], $userData['forename'], $userData['surname']); 
 146                         #TODO: check that password is hashed correctly !!! 
 147                         #$user->setPassword($this->hasher->hashPassword($user, $userData['password'])); 
 148                         $user->setPseudonym($userData['pseudonym']); 
 149                         $user->setPhone($userData['phone']); 
 150                         $user->addGroup($groups[$userData['group']]); 
 151                         $manager->persist($user); 
 156                 //Flush to get the ids 
 160                 //XXX: adding a new zipcode here requires matching accuweather uris in Command/WeatherCommand.php 
 161                 //TODO: add descriptions as well 
 164                                 'title' => 'Garnier opera', 
 165                                 'short' => 'Garnier', 
 166                                 'address' => '10 Place de l\'Opéra', 
 167                                 'zipcode' => '75009', 
 169                                 'latitude' => 48.871268, 
 170                                 'longitude' => 2.331832, 
 175                                 'title' => 'Tino-Rossi garden', 
 177                                 'address' => '2 Quai Saint-Bernard', 
 178                                 'zipcode' => '75005', 
 180                                 'latitude' => 48.847736, 
 181                                 'longitude' => 2.360953, 
 186                                 'title' => 'Trocadero esplanade', 
 187                                 'short' => 'Trocadero', 
 188                                 'address' => '1 Avenue Hussein 1er de Jordanie', 
 189                                 #75016 pour meteo-france, accuweather supporte 75116 
 190                                 'zipcode' => '75116', 
 192                                 'latitude' => 48.861888, 
 193                                 'longitude' => 2.288853, 
 198                                 'title' => 'Colette place', 
 199                                 'short' => 'Colette', 
 200                                 'address' => 'Galerie du Théâtre Français', 
 201                                 'zipcode' => '75001', 
 203                                 'latitude' => 48.863219, 
 204                                 'longitude' => 2.335847, 
 209                                 'title' => 'Swan island', 
 211                                 'address' => 'Allée des Cygnes', 
 212                                 'zipcode' => '75015', 
 214                                 'latitude' => 48.849976, #48.849976 
 215                                 'longitude' => 2.279603, #2.2796029, 
 220                                 'title' => 'Jussieu esplanade', 
 221                                 'short' => 'Jussieu', 
 222                                 'address' => '25 rue des Fossés Saint-Bernard', 
 223                                 'zipcode' => '75005', 
 225                                 'latitude' => 48.847955, #48.8479548 
 226                                 'longitude' => 2.353291, #2.3532907, 
 231                                 'title' => 'Orleans gallery', 
 232                                 'short' => 'Orleans', 
 233                                 'address' => '8 Galerie du Jardin', 
 234                                 'zipcode' => '75001', 
 236                                 'latitude' => 48.863885, 
 237                                 'longitude' => 2.337387, 
 242                                 'title' => 'Orsay museum', 
 244                                 'address' => '1 rue de la Légion d\'Honneur', 
 245                                 'zipcode' => '75007', 
 247                                 'latitude' => 48.860418, 
 248                                 'longitude' => 2.325815, 
 253                                 'title' => 'Saint-Honore market', 
 255                                 'address' => '1 Passage des Jacobins', 
 256                                 'zipcode' => '75001', 
 258                                 'latitude' => 48.866992, 
 259                                 'longitude' => 2.331752, 
 264                                 'title' => 'Igor Stravinsky place', 
 265                                 'short' => 'Stravinsky', 
 266                                 'address' => '2 rue Brisemiche', 
 267                                 'zipcode' => '75004', 
 269                                 'latitude' => 48.859244, 
 270                                 'longitude' => 2.351289, 
 275                                 'title' => 'Tokyo palace', 
 277                                 'address' => '14 Avenue de New York', 
 278                                 'zipcode' => '75116', 
 280                                 'latitude' => 48.863827, 
 281                                 'longitude' => 2.297339, 
 286                                 'title' => 'Drawings\' garden', 
 287                                 'short' => 'Villette', 
 288                                 'address' => 'Allée du Belvédère', 
 289                                 'zipcode' => '75019', 
 291                                 'latitude' => 48.892503, 
 292                                 'longitude' => 2.389300, 
 297                                 'title' => 'Louvre palace', 
 299                                 'address' => 'Quai François Mitterrand', 
 300                                 'zipcode' => '75001', 
 302                                 'latitude' => 48.860386, 
 303                                 'longitude' => 2.332611, 
 308                                 'title' => 'Monde garden', 
 309                                 'address' => '63 avenue Pierre Mendès-France', 
 310                                 'zipcode' => '75013', 
 312                                 'latitude' => 48.840451, 
 313                                 'longitude' => 2.367638, 
 321                 foreach($locationTree as $locationData) { 
 322                         $location = new Location($locationData['title'], $locationData['address'], $locationData['zipcode'], $locationData['city'], $locationData['latitude'], $locationData['longitude'], $locationData['hotspot'], $locationData['indoor']); 
 323                         $manager->persist($location); 
 324                         $locations[$locationData['title']] = $location; 
 328                 //Flush to get the ids 
 341                 foreach($slotTree as $slotData) { 
 342                         $slot = new Slot($slotData); 
 343                         $manager->persist($slot); 
 344                         $slots[$slot->getId()] = $slot; 
 348                 //Flush to get the ids