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' => 'denis.courvoisier@wanadoo.fr',
88 'pseudonym' => 'Sined',
89 'forename' => 'Denis',
90 'surname' => 'Courvoisier',
91 'phone' => '+33600000000',
97 'mail' => 'rannou402@orange.fr',
98 'pseudonym' => 'Mitch',
99 'forename' => 'Michel',
100 'surname' => 'Rannou',
101 'phone' => '+33600000000',
106 'group' => 'Regular',
107 'mail' => 'roxmaps@gmail.com',
108 'pseudonym' => 'Roxana',
109 'forename' => 'Roxana',
110 'surname' => 'Prado',
111 'phone' => '+33600000000',
118 foreach($userTree as $userData) {
120 $user->setMail($userData['mail']);
121 $user->setPseudonym($userData['pseudonym']);
122 $user->setForename($userData['forename']);
123 $user->setSurname($userData['surname']);
124 $user->setPhone($userData['phone']);
125 $user->setPassword($encoder->encodePassword($user, $userData['password']));
126 $user->setActive(true);
127 $user->setTitle($titles[$userData['short']]);
128 $user->addGroup($groups[$userData['group']]);
129 $user->setCreated(new \
DateTime('now'));
130 $user->setUpdated(new \
DateTime('now'));
131 $manager->persist($user);
136 //Flush to get the ids
142 'title' => 'Trocadero esplanade',
143 'short' => 'Trocadero',
144 'address' => '1 Avenue Hussein 1er de Jordanie',
145 #75016 pour meteo-france, accuweather supporte 75116
146 'zipcode' => '75116',
148 'latitude' => 48.861888,
149 'longitude' => 2.288853
152 'title' => 'Orleans gallery',
153 'short' => 'Orleans',
154 'address' => '8 Galerie du Jardin',
155 'zipcode' => '75001',
157 'latitude' => 48.863885,
158 'longitude' => 2.337387
161 'title' => 'Colette square',
162 'short' => 'Colette',
163 'address' => 'Galerie du Théâtre Français',
164 'zipcode' => '75001',
166 'latitude' => 48.863219,
167 'longitude' => 2.335847
170 'title' => 'Tino-Rossi garden',
172 'address' => '2 Quai Saint-Bernard',
173 'zipcode' => '75005',
175 'latitude' => 48.847736,
176 'longitude' => 2.360953
179 'title' => 'Drawings\' garden',
180 'short' => 'Villette',
181 'address' => 'Allée du Belvédère',
182 'zipcode' => '75019',
184 'latitude' => 48.892503,
185 'longitude' => 2.389300
188 'title' => 'Saint-Honore market',
189 'short' => 'St-Honore',
190 'address' => '1 Passage des Jacobins',
191 'zipcode' => '75001',
193 'latitude' => 48.866992,
194 'longitude' => 2.331752
197 'title' => 'Orsay museum',
199 'address' => '1 rue de la Légion d\'Honneur',
200 'zipcode' => '75007',
202 'latitude' => 48.860418,
203 'longitude' => 2.325815
206 'title' => 'Opera Garnier',
208 'address' => '10 Place de l\'Opéra',
209 'zipcode' => '75009',
211 'latitude' => 48.871268,
212 'longitude' => 2.331832
215 'title' => 'Tokyo palace',
217 'address' => '14 Avenue de New York',
218 'zipcode' => '75116',
220 'latitude' => 48.863827,
221 'longitude' => 2.297339
226 $locations = array();
227 foreach($locationTree as $locationData) {
228 $location = new Location();
229 $location->setTitle($locationData['title']);
230 $location->setShort($locationData['short']);
231 $location->setAddress($locationData['address']);
232 $location->setZipcode($locationData['zipcode']);
233 $location->setCity($locationData['city']);
234 $location->setLatitude($locationData['latitude']);
235 $location->setLongitude($locationData['longitude']);
236 $location->setCreated(new \
DateTime('now'));
237 $location->setUpdated(new \
DateTime('now'));
238 $manager->persist($location);
239 $locations[$locationData['title']] = $location;
243 //Flush to get the ids
256 foreach($slotTree as $slotData) {
258 $slot->setTitle($slotData);
259 $slot->setCreated(new \
DateTime('now'));
260 $slot->setUpdated(new \
DateTime('now'));
261 $manager->persist($slot);
262 $slots[$slot->getId()] = $slot;
266 //Flush to get the ids