3 namespace Rapsys\AirBundle\DataFixtures
;
5 use Rapsys\AirBundle\Entity\Civility
;
6 use Rapsys\AirBundle\Entity\Group
;
7 use Rapsys\AirBundle\Entity\User
;
8 use Rapsys\AirBundle\Entity\Location
;
9 use Rapsys\AirBundle\Entity\Slot
;
11 class AirFixtures
extends \Doctrine\Bundle\FixturesBundle\Fixture
implements \Symfony\Component\DependencyInjection\ContainerAwareInterface
{
13 * @var ContainerInterface
17 public function setContainer(\Symfony\Component\DependencyInjection\ContainerInterface
$container = null) {
18 $this->container
= $container;
24 public function load(\Doctrine\Common\Persistence\ObjectManager
$manager) {
25 $encoder = $this->container
->get('security.password_encoder');
28 $civilityTree = array(
36 foreach($civilityTree as $shortData => $civilityData) {
37 $civility = new Title($civilityData);
38 $civility->setShort($shortData);
39 $civility->setCreated(new \
DateTime('now'));
40 $civility->setUpdated(new \
DateTime('now'));
41 $manager->persist($civility);
42 $civilitys[$shortData] = $civility;
47 //XXX: ROLE_XXX is required by
58 foreach($groupTree as $groupData) {
59 $group = new Group($groupData);
60 $group->setCreated(new \
DateTime('now'));
61 $group->setUpdated(new \
DateTime('now'));
62 $manager->persist($group);
63 $groups[$groupData] = $group;
67 //Flush to get the ids
75 'mail' => 'tango@rapsys.eu',
76 'pseudonym' => 'Milonga Raphaël',
77 'forename' => 'Raphaël',
79 'phone' => '+33677952829',
85 'mail' => 'denis.courvoisier@wanadoo.fr',
86 'pseudonym' => 'DJ Sined',
87 'forename' => 'Denis',
88 'surname' => 'Courvoisier',
89 'phone' => '+33600000000',
95 'mail' => 'rannou402@orange.fr',
96 'pseudonym' => 'Trio Tango',
97 'forename' => 'Michel',
98 'surname' => 'Rannou',
99 'phone' => '+33600000000',
104 'group' => 'Regular',
105 'mail' => 'roxmaps@gmail.com',
106 'pseudonym' => 'Roxana',
107 'forename' => 'Roxana',
108 'surname' => 'Prado',
109 'phone' => '+33600000000',
116 foreach($userTree as $userData) {
117 $user = new User($userData['mail']);
118 $user->setPseudonym($userData['pseudonym']);
119 $user->setForename($userData['forename']);
120 $user->setSurname($userData['surname']);
121 $user->setPhone($userData['phone']);
122 $user->setPassword($encoder->encodePassword($user, $userData['password']));
123 $user->setCivility($civilitys[$userData['short']]);
124 $user->addGroup($groups[$userData['group']]);
125 $user->setCreated(new \
DateTime('now'));
126 $user->setUpdated(new \
DateTime('now'));
127 $manager->persist($user);
132 //Flush to get the ids
136 //XXX: adding a new zipcode here requires matching accuweather uris in Command/WeatherCommand.php
139 'title' => 'Garnier opera',
140 'short' => 'Garnier',
141 'address' => '10 Place de l\'Opéra',
142 'zipcode' => '75009',
144 'latitude' => 48.871268,
145 'longitude' => 2.331832,
149 'title' => 'Tino-Rossi garden',
151 'address' => '2 Quai Saint-Bernard',
152 'zipcode' => '75005',
154 'latitude' => 48.847736,
155 'longitude' => 2.360953,
159 'title' => 'Trocadero esplanade',
160 'short' => 'Trocadero',
161 'address' => '1 Avenue Hussein 1er de Jordanie',
162 #75016 pour meteo-france, accuweather supporte 75116
163 'zipcode' => '75116',
165 'latitude' => 48.861888,
166 'longitude' => 2.288853,
170 'title' => 'Colette place',
171 'short' => 'Colette',
172 'address' => 'Galerie du Théâtre Français',
173 'zipcode' => '75001',
175 'latitude' => 48.863219,
176 'longitude' => 2.335847,
180 'title' => 'Swan island',
182 'address' => 'Allée des Cygnes',
183 'zipcode' => '75015',
185 'latitude' => 48.849976, #48.849976
186 'longitude' => 2.279603, #2.2796029,
190 'title' => 'Jussieu esplanade',
191 'short' => 'Jussieu',
192 'address' => '25 rue des Fossés Saint-Bernard',
193 'zipcode' => '75005',
195 'latitude' => 48.847955, #48.8479548
196 'longitude' => 2.353291, #2.3532907,
200 'title' => 'Orleans gallery',
201 'short' => 'Orleans',
202 'address' => '8 Galerie du Jardin',
203 'zipcode' => '75001',
205 'latitude' => 48.863885,
206 'longitude' => 2.337387,
210 'title' => 'Orsay museum',
212 'address' => '1 rue de la Légion d\'Honneur',
213 'zipcode' => '75007',
215 'latitude' => 48.860418,
216 'longitude' => 2.325815,
220 'title' => 'Saint-Honore market',
222 'address' => '1 Passage des Jacobins',
223 'zipcode' => '75001',
225 'latitude' => 48.866992,
226 'longitude' => 2.331752,
230 'title' => 'Igor Stravinsky place',
231 'short' => 'Stravinsky',
232 'address' => '2 rue Brisemiche',
233 'zipcode' => '75004',
235 'latitude' => 48.859244,
236 'longitude' => 2.351289,
240 'title' => 'Tokyo palace',
242 'address' => '14 Avenue de New York',
243 'zipcode' => '75116',
245 'latitude' => 48.863827,
246 'longitude' => 2.297339,
250 'title' => 'Drawings\' garden',
251 'short' => 'Villette',
252 'address' => 'Allée du Belvédère',
253 'zipcode' => '75019',
255 'latitude' => 48.892503,
256 'longitude' => 2.389300,
260 'title' => 'Louvre palace',
262 'address' => 'Quai François Mitterrand',
263 'zipcode' => '75001',
265 'latitude' => 48.860386,
266 'longitude' => 2.332611,
270 'title' => 'Monde garden',
272 'address' => '63 avenue Pierre Mendès-France',
273 'zipcode' => '75013',
275 'latitude' => 48.840451,
276 'longitude' => 2.367638,
282 $locations = array();
283 foreach($locationTree as $locationData) {
284 $location = new Location();
285 $location->setTitle($locationData['title']);
286 $location->setShort($locationData['short']);
287 $location->setAddress($locationData['address']);
288 $location->setZipcode($locationData['zipcode']);
289 $location->setCity($locationData['city']);
290 $location->setLatitude($locationData['latitude']);
291 $location->setLongitude($locationData['longitude']);
292 $location->setHotspot($locationData['hotspot']);
293 $location->setCreated(new \
DateTime('now'));
294 $location->setUpdated(new \
DateTime('now'));
295 $manager->persist($location);
296 $locations[$locationData['title']] = $location;
300 //Flush to get the ids
313 foreach($slotTree as $slotData) {
315 $slot->setTitle($slotData);
316 $slot->setCreated(new \
DateTime('now'));
317 $slot->setUpdated(new \
DateTime('now'));
318 $manager->persist($slot);
319 $slots[$slot->getId()] = $slot;
323 //Flush to get the ids