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)
19 $this->container
= $container;
25 public function load(\Doctrine\Common\Persistence\ObjectManager
$manager) {
26 $encoder = $this->container
->get('security.password_encoder');
37 foreach($titleTree as $shortData => $titleData) {
39 $title->setShort($shortData);
40 $title->setTitle($titleData);
41 $title->setCreated(new \
DateTime('now'));
42 $title->setUpdated(new \
DateTime('now'));
43 $manager->persist($title);
44 $titles[$shortData] = $title;
49 //XXX: ROLE_XXX is required by
60 foreach($groupTree as $groupData) {
61 $group = new Group($groupData);
62 $group->setCreated(new \
DateTime('now'));
63 $group->setUpdated(new \
DateTime('now'));
64 $manager->persist($group);
65 $groups[$groupData] = $group;
69 //Flush to get the ids
77 'mail' => 'tango@rapsys.eu',
78 'pseudonym' => 'Rapsys',
79 'forename' => 'Raphaël',
81 'phone' => '+33677952829',
87 'mail' => 'rannou402@orange.fr',
88 'pseudonym' => 'Mitch',
89 'forename' => 'Michel',
90 'surname' => 'Rannou',
91 'phone' => '+33600000000',
97 'mail' => 'roxmaps@gmail.com',
98 'pseudonym' => 'Roxana',
99 'forename' => 'Roxana',
100 'surname' => 'Prado',
101 'phone' => '+33600000000',
106 'group' => 'Regular',
107 'mail' => 'majid.ghedjatti@gmail.com',
108 'pseudonym' => 'El Guerrillero',
109 'forename' => 'Majid',
110 'surname' => 'Ghedjatti',
111 'phone' => '+33600000000',
117 'mail' => 'denis.courvoisier@wanadoo.fr',
118 'pseudonym' => 'Sined',
119 'forename' => 'Denis',
120 'surname' => 'Courvoisier',
121 'phone' => '+33600000000',
126 'group' => 'Regular',
127 'mail' => 'kastango13@gmail.com',
128 'pseudonym' => 'Kastrat',
129 'forename' => 'Kastrat',
130 'surname' => 'Hasaj',
131 'phone' => '+33600000000',
138 foreach($userTree as $userData) {
140 $user->setMail($userData['mail']);
141 $user->setPseudonym($userData['pseudonym']);
142 $user->setForename($userData['forename']);
143 $user->setSurname($userData['surname']);
144 $user->setPhone($userData['phone']);
145 $user->setPassword($encoder->encodePassword($user, $userData['password']));
146 $user->setActive(true);
147 $user->setTitle($titles[$userData['short']]);
148 $user->addGroup($groups[$userData['group']]);
149 $user->setCreated(new \
DateTime('now'));
150 $user->setUpdated(new \
DateTime('now'));
151 $manager->persist($user);
156 //Flush to get the ids
162 'title' => 'Trocadero esplanade',
163 'short' => 'Trocadero',
164 'address' => '1 Avenue Hussein 1er de Jordanie',
165 #75016 pour meteo-france, accuweather supporte 75116
166 'zipcode' => '75116',
168 'latitude' => 48.861888,
169 'longitude' => 2.288853
172 'title' => 'Orleans gallery',
173 'short' => 'Orleans',
174 'address' => '8 Galerie du Jardin',
175 'zipcode' => '75001',
177 'latitude' => 48.863885,
178 'longitude' => 2.337387
181 'title' => 'Colette square',
182 'short' => 'Colette',
183 'address' => 'Galerie du Théâtre Français',
184 'zipcode' => '75001',
186 'latitude' => 48.863219,
187 'longitude' => 2.335847
190 'title' => 'Tino-Rossi garden',
192 'address' => '2 Quai Saint-Bernard',
193 'zipcode' => '75005',
195 'latitude' => 48.847736,
196 'longitude' => 2.360953
199 'title' => 'Drawings\' garden',
200 'short' => 'Villette',
201 'address' => 'Allée du Belvédère',
202 'zipcode' => '75019',
204 'latitude' => 48.892503,
205 'longitude' => 2.389300
208 'title' => 'Saint-Honore market',
209 'short' => 'St-Honore',
210 'address' => '1 Passage des Jacobins',
211 'zipcode' => '75001',
213 'latitude' => 48.866992,
214 'longitude' => 2.331752
217 'title' => 'Orsay museum',
219 'address' => '1 rue de la Légion d\'Honneur',
220 'zipcode' => '75007',
222 'latitude' => 48.860418,
223 'longitude' => 2.325815
226 'title' => 'Opera Garnier',
228 'address' => '10 Place de l\'Opéra',
229 'zipcode' => '75009',
231 'latitude' => 48.871268,
232 'longitude' => 2.331832
235 'title' => 'Tokyo palace',
237 'address' => '14 Avenue de New York',
238 'zipcode' => '75116',
240 'latitude' => 48.863827,
241 'longitude' => 2.297339
246 $locations = array();
247 foreach($locationTree as $locationData) {
248 $location = new Location();
249 $location->setTitle($locationData['title']);
250 $location->setShort($locationData['short']);
251 $location->setAddress($locationData['address']);
252 $location->setZipcode($locationData['zipcode']);
253 $location->setCity($locationData['city']);
254 $location->setLatitude($locationData['latitude']);
255 $location->setLongitude($locationData['longitude']);
256 $location->setCreated(new \
DateTime('now'));
257 $location->setUpdated(new \
DateTime('now'));
258 $manager->persist($location);
259 $locations[$locationData['title']] = $location;
263 //Flush to get the ids
276 foreach($slotTree as $slotData) {
278 $slot->setTitle($slotData);
279 $slot->setCreated(new \
DateTime('now'));
280 $slot->setUpdated(new \
DateTime('now'));
281 $manager->persist($slot);
282 $slots[$slot->getId()] = $slot;
286 //Flush to get the ids