3 namespace Rapsys\AirBundle\DataFixtures
;
5 use Rapsys\AirBundle\Entity\Title
;
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');
36 foreach($titleTree as $shortData => $titleData) {
38 $title->setShort($shortData);
39 $title->setTitle($titleData);
40 $title->setCreated(new \
DateTime('now'));
41 $title->setUpdated(new \
DateTime('now'));
42 $manager->persist($title);
43 $titles[$shortData] = $title;
48 //XXX: ROLE_XXX is required by
59 foreach($groupTree as $groupData) {
60 $group = new Group($groupData);
61 $group->setCreated(new \
DateTime('now'));
62 $group->setUpdated(new \
DateTime('now'));
63 $manager->persist($group);
64 $groups[$groupData] = $group;
68 //Flush to get the ids
76 'mail' => 'tango@rapsys.eu',
77 'pseudonym' => 'Milonga Raphaël',
78 'forename' => 'Raphaël',
80 'phone' => '+33677952829',
86 'mail' => 'denis.courvoisier@wanadoo.fr',
87 'pseudonym' => 'DJ Sined',
88 'forename' => 'Denis',
89 'surname' => 'Courvoisier',
90 'phone' => '+33600000000',
96 'mail' => 'rannou402@orange.fr',
97 'pseudonym' => 'Trio Tango',
98 'forename' => 'Michel',
99 'surname' => 'Rannou',
100 'phone' => '+33600000000',
105 'group' => 'Regular',
106 'mail' => 'roxmaps@gmail.com',
107 'pseudonym' => 'Roxana',
108 'forename' => 'Roxana',
109 'surname' => 'Prado',
110 'phone' => '+33600000000',
117 foreach($userTree as $userData) {
119 $user->setMail($userData['mail']);
120 $user->setPseudonym($userData['pseudonym']);
121 $user->setForename($userData['forename']);
122 $user->setSurname($userData['surname']);
123 $user->setPhone($userData['phone']);
124 $user->setPassword($encoder->encodePassword($user, $userData['password']));
125 $user->setActive(true);
126 $user->setTitle($titles[$userData['short']]);
127 $user->addGroup($groups[$userData['group']]);
128 $user->setCreated(new \
DateTime('now'));
129 $user->setUpdated(new \
DateTime('now'));
130 $manager->persist($user);
135 //Flush to get the ids
139 //XXX: adding a new zipcode here requires matching accuweather uris in Command/WeatherCommand.php
142 'title' => 'Opera Garnier',
143 'short' => 'Garnier',
144 'address' => '10 Place de l\'Opéra',
145 'zipcode' => '75009',
147 'latitude' => 48.871268,
148 'longitude' => 2.331832
151 'title' => 'Tino-Rossi garden',
153 'address' => '2 Quai Saint-Bernard',
154 'zipcode' => '75005',
156 'latitude' => 48.847736,
157 'longitude' => 2.360953
160 'title' => 'Trocadero esplanade',
161 'short' => 'Trocadero',
162 'address' => '1 Avenue Hussein 1er de Jordanie',
163 #75016 pour meteo-france, accuweather supporte 75116
164 'zipcode' => '75116',
166 'latitude' => 48.861888,
167 'longitude' => 2.288853
170 'title' => 'Colette square',
171 'short' => 'Colette',
172 'address' => 'Galerie du Théâtre Français',
173 'zipcode' => '75001',
175 'latitude' => 48.863219,
176 'longitude' => 2.335847
179 'title' => 'Swan Island',
181 'address' => 'Allée des Cygnes',
182 'zipcode' => '75015',
184 'latitude' => 48.849976, #48.849976
185 'longitude' => 2.279603 #2.2796029
188 'title' => 'Jussieu esplanade',
189 'short' => 'Jussieu',
190 'address' => '25 rue des Fossés Saint-Bernard',
191 'zipcode' => '75005',
193 'latitude' => 48.847955, #48.8479548
194 'longitude' => 2.353291 #2.3532907
197 'title' => 'Orleans gallery',
198 'short' => 'Orleans',
199 'address' => '8 Galerie du Jardin',
200 'zipcode' => '75001',
202 'latitude' => 48.863885,
203 'longitude' => 2.337387
206 'title' => 'Orsay museum',
208 'address' => '1 rue de la Légion d\'Honneur',
209 'zipcode' => '75007',
211 'latitude' => 48.860418,
212 'longitude' => 2.325815
215 'title' => 'Saint-Honore market',
217 'address' => '1 Passage des Jacobins',
218 'zipcode' => '75001',
220 'latitude' => 48.866992,
221 'longitude' => 2.331752
224 'title' => 'Tokyo palace',
226 'address' => '14 Avenue de New York',
227 'zipcode' => '75116',
229 'latitude' => 48.863827,
230 'longitude' => 2.297339
233 'title' => 'Drawings\' garden',
234 'short' => 'Villette',
235 'address' => 'Allée du Belvédère',
236 'zipcode' => '75019',
238 'latitude' => 48.892503,
239 'longitude' => 2.389300
244 $locations = array();
245 foreach($locationTree as $locationData) {
246 $location = new Location();
247 $location->setTitle($locationData['title']);
248 $location->setShort($locationData['short']);
249 $location->setAddress($locationData['address']);
250 $location->setZipcode($locationData['zipcode']);
251 $location->setCity($locationData['city']);
252 $location->setLatitude($locationData['latitude']);
253 $location->setLongitude($locationData['longitude']);
254 $location->setCreated(new \
DateTime('now'));
255 $location->setUpdated(new \
DateTime('now'));
256 $manager->persist($location);
257 $locations[$locationData['title']] = $location;
261 //Flush to get the ids
274 foreach($slotTree as $slotData) {
276 $slot->setTitle($slotData);
277 $slot->setCreated(new \
DateTime('now'));
278 $slot->setUpdated(new \
DateTime('now'));
279 $manager->persist($slot);
280 $slots[$slot->getId()] = $slot;
284 //Flush to get the ids