This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /* |
||
3 | * Copyright 2014-2016 Arnaud Bienvenu |
||
4 | * |
||
5 | * This file is part of Kyela. |
||
6 | |||
7 | * Kyela is free software: you can redistribute it and/or modify |
||
8 | * it under the terms of the GNU Affero General Public License as published by |
||
9 | * the Free Software Foundation, either version 3 of the License, or |
||
10 | * (at your option) any later version. |
||
11 | |||
12 | * Kyela is distributed in the hope that it will be useful, |
||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
15 | * GNU Affero General Public License for more details. |
||
16 | |||
17 | * You should have received a copy of the GNU Affero General Public License |
||
18 | * along with Kyela. If not, see <http://www.gnu.org/licenses/>. |
||
19 | * |
||
20 | */ |
||
21 | |||
22 | namespace Abienvenu\KyelaBundle\DataFixtures\ORM; |
||
23 | |||
24 | use Doctrine\Common\DataFixtures\FixtureInterface; |
||
25 | use Doctrine\Common\Persistence\ObjectManager; |
||
26 | use Abienvenu\KyelaBundle\Entity\Poll; |
||
27 | use Abienvenu\KyelaBundle\Entity\Event; |
||
28 | use Abienvenu\KyelaBundle\Entity\Choice; |
||
29 | use Abienvenu\KyelaBundle\Entity\Participant; |
||
30 | use Abienvenu\KyelaBundle\Entity\Participation; |
||
31 | |||
32 | class LoadExamplePolls implements FixtureInterface |
||
33 | { |
||
34 | protected function loadConcert(ObjectManager $manager) |
||
35 | { |
||
36 | $names = ['Aretha', 'Jimmy', 'Miles', 'John', 'Paul']; |
||
37 | $events = [ |
||
38 | ['name' => 'Répétition', 'place' => 'Studio', 'date' => new \DateTime('+10 year'), 'time' => new \DateTime('15:00')], |
||
39 | ['name' => 'Générale', 'place' => 'Olympia', 'date' => new \DateTime('+10 year +2 days'), 'time' => new \DateTime('20:30')], |
||
40 | ['name' => 'Concert', 'place' => 'Olympia', 'date' => new \DateTime('+10 year +7 days'), 'time' => new \DateTime('20:00')], |
||
41 | ['name' => 'Concert 2', 'place' => 'New-York', 'date' => new \DateTime('+10 year + 10 days'), 'time' => new \DateTime('20:30')], |
||
42 | ]; |
||
43 | $choices = [ |
||
44 | ['name' => 'Oui', 'value' => 1, 'color' => 'green', 'priority' => 0, 'icon' => 'ok'], |
||
45 | ['name' => 'Non', 'value' => 0, 'color' => 'red', 'priority' => 1, 'icon' => 'remove'], |
||
46 | ['name' => 'Peut-être', 'value' => 0, 'color' => 'gray', 'priority' => 2, 'icon' => 'time'], |
||
47 | ]; |
||
48 | $participations = [ |
||
49 | ['who' => 'Aretha', 'when' => 'Répétition', 'choice' => 'Oui'], |
||
50 | ['who' => 'Jimmy', 'when' => 'Répétition', 'choice' => 'Oui'], |
||
51 | ['who' => 'Miles', 'when' => 'Répétition', 'choice' => 'Non'], |
||
52 | ['who' => 'John', 'when' => 'Répétition', 'choice' => 'Oui'], |
||
53 | ['who' => 'Paul', 'when' => 'Répétition', 'choice' => 'Oui'], |
||
54 | ['who' => 'Aretha', 'when' => 'Générale', 'choice' => 'Peut-être'], |
||
55 | ['who' => 'Jimmy', 'when' => 'Générale', 'choice' => 'Oui'], |
||
56 | ['who' => 'Miles', 'when' => 'Générale', 'choice' => 'Oui'], |
||
57 | ['who' => 'John', 'when' => 'Générale', 'choice' => 'Oui'], |
||
58 | ['who' => 'Paul', 'when' => 'Générale', 'choice' => 'Oui'], |
||
59 | ['who' => 'Aretha', 'when' => 'Concert', 'choice' => 'Oui'], |
||
60 | ['who' => 'Jimmy', 'when' => 'Concert', 'choice' => 'Oui'], |
||
61 | ['who' => 'Miles', 'when' => 'Concert', 'choice' => 'Oui'], |
||
62 | ['who' => 'John', 'when' => 'Concert', 'choice' => 'Oui'], |
||
63 | ['who' => 'Paul', 'when' => 'Concert', 'choice' => 'Non'], |
||
64 | ['who' => 'Aretha', 'when' => 'Concert 2', 'choice' => 'Non'], |
||
65 | ['who' => 'Jimmy', 'when' => 'Concert 2', 'choice' => 'Non'], |
||
66 | ['who' => 'John', 'when' => 'Concert 2', 'choice' => 'Oui'], |
||
67 | ['who' => 'Paul', 'when' => 'Concert 2', 'choice' => 'Peut-être'], |
||
68 | ]; |
||
69 | $this->resetPoll($manager, 'concert', 'Prochaines répétitions', |
||
70 | "Ceci est un sondage d'exemple pour l'organisation d'un concert. |
||
71 | N'hésitez pas à l'essayer, mais les données seront automatiquement réinitialisées chaque matin. |
||
72 | Pour créer votre propre sondage, retournez sur la page d'accueil en cliquant sur \"Kyélà \" en haut à gauche.", |
||
73 | '', $names, $events, $choices, $participations); |
||
74 | } |
||
75 | |||
76 | protected function loadPicnic(ObjectManager $manager) |
||
77 | { |
||
78 | $names = ['Élise', 'Jules', 'Marie', 'Romain', 'Margaux']; |
||
79 | $events = [ |
||
80 | ['name' => 'Date 1', 'place' => 'Central Park', 'date' => new \DateTime('+10 year'), 'time' => new \DateTime('12:00')], |
||
81 | ['name' => 'Date 2', 'place' => 'Central Park', 'date' => new \DateTime('+10 year +1 days'), 'time' => new \DateTime('12:00')], |
||
82 | ]; |
||
83 | $choices = [ |
||
84 | ['name' => 'Sucré', 'value' => 1, 'color' => 'blue', 'priority' => 0, 'icon' => 'cutlery'], |
||
85 | ['name' => 'Salé', 'value' => 1, 'color' => 'cyan', 'priority' => 1, 'icon' => 'cutlery'], |
||
86 | ['name' => 'Boisson', 'value' => 1, 'color' => 'purple', 'priority' => 2, 'icon' => 'glass'], |
||
87 | ['name' => 'Absent', 'value' => 0, 'color' => 'gray', 'priority' => 3, 'icon' => 'plane'], |
||
88 | ]; |
||
89 | $participations = [ |
||
90 | ['who' => 'Élise', 'when' => 'Date 1', 'choice' => 'Sucré'], |
||
91 | ['who' => 'Jules', 'when' => 'Date 1', 'choice' => 'Salé'], |
||
92 | ['who' => 'Marie', 'when' => 'Date 1', 'choice' => 'Boisson'], |
||
93 | ['who' => 'Romain', 'when' => 'Date 1', 'choice' => 'Sucré'], |
||
94 | ['who' => 'Margaux', 'when' => 'Date 1', 'choice' => 'Salé'], |
||
95 | ['who' => 'Élise', 'when' => 'Date 2', 'choice' => 'Sucré'], |
||
96 | ['who' => 'Jules', 'when' => 'Date 2', 'choice' => 'Absent'], |
||
97 | ['who' => 'Marie', 'when' => 'Date 2', 'choice' => 'Boisson'], |
||
98 | ['who' => 'Romain', 'when' => 'Date 2', 'choice' => 'Sucré'], |
||
99 | ['who' => 'Margaux', 'when' => 'Date 2', 'choice' => 'Salé'], |
||
100 | ]; |
||
101 | $this->resetPoll($manager, 'picnic', 'Pique-nique', |
||
102 | "Ceci est un sondage d'exemple pour l'organisation d'un pique-nique. |
||
103 | N'hésitez pas à l'essayer, mais les données seront automatiquement réinitialisées chaque matin. |
||
104 | Pour créer votre propre sondage, retournez sur la page d'accueil en cliquant sur \"Kyélà \" en haut à gauche.", |
||
105 | '', $names, $events, $choices, $participations); |
||
106 | } |
||
107 | |||
108 | protected function loadHolidays(ObjectManager $manager) |
||
109 | { |
||
110 | $names = ['Jean', 'Lisa', 'Étienne', 'Martine', 'Lilou']; |
||
111 | $events = [ |
||
112 | ['name' => 'Vacances de février'], |
||
113 | ['name' => 'Vacances de Pâques'], |
||
114 | ['name' => 'Vacances d\'été'], |
||
115 | ]; |
||
116 | $choices = [ |
||
117 | ['name' => 'Les Alpes', 'value' => 1, 'color' => 'cyan', 'priority' => 0, 'icon' => 'tree-conifer'], |
||
118 | ['name' => 'Les Pyrénées', 'value' => 1, 'color' => 'blue', 'priority' => 1, 'icon' => 'tree-conifer'], |
||
119 | ['name' => 'Les Canaries', 'value' => 1, 'color' => 'orange', 'priority' => 2, 'icon' => 'plane'], |
||
120 | ['name' => 'Peu importe', 'value' => 1, 'color' => 'purple', 'priority' => 2, 'icon' => 'globe'], |
||
121 | ['name' => 'Je ne pars pas', 'value' => 0, 'color' => 'gray', 'priority' => 3, 'icon' => 'home'], |
||
122 | ]; |
||
123 | $participations = [ |
||
124 | ['who' => 'Jean', 'when' => 'Vacances de février', 'choice' => 'Les Alpes'], |
||
125 | ['who' => 'Lisa', 'when' => 'Vacances de février', 'choice' => 'Les Alpes'], |
||
126 | ['who' => 'Étienne', 'when' => 'Vacances de février', 'choice' => 'Les Canaries'], |
||
127 | ['who' => 'Martine', 'when' => 'Vacances de février', 'choice' => 'Les Pyrénées'], |
||
128 | ['who' => 'Lilou', 'when' => 'Vacances de février', 'choice' => 'Les Alpes'], |
||
129 | ['who' => 'Jean', 'when' => 'Vacances de Pâques', 'choice' => 'Les Alpes'], |
||
130 | ['who' => 'Lisa', 'when' => 'Vacances de Pâques', 'choice' => 'Je ne pars pas'], |
||
131 | ['who' => 'Étienne', 'when' => 'Vacances de Pâques', 'choice' => 'Les Canaries'], |
||
132 | ['who' => 'Martine', 'when' => 'Vacances de Pâques', 'choice' => 'Les Pyrénées'], |
||
133 | ['who' => 'Lilou', 'when' => 'Vacances de Pâques', 'choice' => 'Je ne pars pas'], |
||
134 | ['who' => 'Jean', 'when' => 'Vacances d\'été', 'choice' => 'Les Canaries'], |
||
135 | ['who' => 'Lisa', 'when' => 'Vacances d\'été', 'choice' => 'Les Canaries'], |
||
136 | ['who' => 'Étienne', 'when' => 'Vacances d\'été', 'choice' => 'Les Canaries'], |
||
137 | ['who' => 'Martine', 'when' => 'Vacances d\'été', 'choice' => 'Peu importe'], |
||
138 | ['who' => 'Lilou', 'when' => 'Vacances d\'été', 'choice' => 'Les Canaries'], |
||
139 | ]; |
||
140 | $this->resetPoll($manager, 'holidays', 'Vacances', |
||
141 | "Ceci est un sondage d'exemple pour l'organisation de vacances entre amis ou en famille. |
||
142 | N'hésitez pas à l'essayer, mais les données seront automatiquement réinitialisées chaque matin. |
||
143 | Pour créer votre propre sondage, retournez sur la page d'accueil en cliquant sur \"Kyélà \" en haut à gauche.", |
||
144 | 'Où souhaitez-vous partir ?', |
||
145 | $names, $events, $choices, $participations); |
||
146 | } |
||
147 | |||
148 | protected function loadVolley(ObjectManager $manager) |
||
149 | { |
||
150 | $names = ['Jean', 'Marilou', 'Mehdi', 'Élodie', 'Cécile', 'Vincent', 'Patricia', 'Cyril', 'Lucie']; |
||
151 | $events = [ |
||
152 | ['name' => 'Entraînement', 'date' => new \DateTime('+10 year'), 'time' => new \DateTime('20:30')], |
||
153 | ['name' => 'Chanteloup 1 / Bourg-des-Comptes 1', 'place' => 'Chanteloup', 'date' => new \DateTime('+10 year + 7 days'), 'time' => new \DateTime('20:15')], |
||
154 | ['name' => 'Entraînement ', 'date' => new \DateTime('+10 year + 14 days'), 'time' => new \DateTime('20:30')], |
||
155 | ['name' => 'Bruz 2 / Chanteloup 1', 'place' => 'Bruz', 'date' => new \DateTime('+10 year + 14 days'), 'time' => new \DateTime('20:00')], |
||
156 | ]; |
||
157 | $choices = [ |
||
158 | ['name' => 'Oui', 'value' => 1, 'color' => 'green', 'priority' => 0, 'icon' => 'ok'], |
||
159 | ['name' => 'Non', 'value' => 0, 'color' => 'red', 'priority' => 1, 'icon' => 'remove'], |
||
160 | ['name' => 'Si nécessaire', 'value' => 0, 'color' => 'orange', 'priority' => 2, 'icon' => 'phone'], |
||
161 | ['name' => 'Arbitre', 'value' => 0, 'color' => 'gray', 'priority' => 3, 'icon' => 'bullhorn'], |
||
162 | ['name' => 'Gâteau!', 'value' => 1, 'color' => 'purple', 'priority' => 4, 'icon' => 'cutlery'], |
||
163 | ['name' => 'Chauffeur', 'value' => 1, 'color' => 'green', 'priority' => 5, 'icon' => 'road'], |
||
164 | ]; |
||
165 | $participations = [ |
||
166 | ['who' => 'Jean', 'when' => 'Entraînement', 'choice' => 'Oui'], |
||
167 | ['who' => 'Marilou', 'when' => 'Entraînement', 'choice' => 'Non'], |
||
168 | ['who' => 'Mehdi', 'when' => 'Entraînement', 'choice' => 'Oui'], |
||
169 | ['who' => 'Élodie', 'when' => 'Entraînement', 'choice' => 'Oui'], |
||
170 | ['who' => 'Cécile', 'when' => 'Entraînement', 'choice' => 'Oui'], |
||
171 | ['who' => 'Vincent', 'when' => 'Entraînement', 'choice' => 'Non'], |
||
172 | ['who' => 'Patricia', 'when' => 'Entraînement', 'choice' => 'Oui'], |
||
173 | ['who' => 'Cyril', 'when' => 'Entraînement', 'choice' => 'Oui'], |
||
174 | ['who' => 'Lucie', 'when' => 'Entraînement', 'choice' => 'Oui'], |
||
175 | ['who' => 'Jean', 'when' => 'Chanteloup 1 / Bourg-des-Comptes 1', 'choice' => 'Oui'], |
||
176 | ['who' => 'Marilou', 'when' => 'Chanteloup 1 / Bourg-des-Comptes 1', 'choice' => 'Arbitre'], |
||
177 | ['who' => 'Mehdi', 'when' => 'Chanteloup 1 / Bourg-des-Comptes 1', 'choice' => 'Non'], |
||
178 | ['who' => 'Élodie', 'when' => 'Chanteloup 1 / Bourg-des-Comptes 1', 'choice' => 'Gâteau!'], |
||
179 | ['who' => 'Cécile', 'when' => 'Chanteloup 1 / Bourg-des-Comptes 1', 'choice' => 'Oui'], |
||
180 | ['who' => 'Vincent', 'when' => 'Chanteloup 1 / Bourg-des-Comptes 1', 'choice' => 'Non'], |
||
181 | ['who' => 'Patricia', 'when' => 'Chanteloup 1 / Bourg-des-Comptes 1', 'choice' => 'Oui'], |
||
182 | ['who' => 'Cyril', 'when' => 'Chanteloup 1 / Bourg-des-Comptes 1', 'choice' => 'Oui'], |
||
183 | ['who' => 'Lucie', 'when' => 'Chanteloup 1 / Bourg-des-Comptes 1', 'choice' => 'Si nécessaire'], |
||
184 | ['who' => 'Jean', 'when' => 'Entraînement ', 'choice' => 'Oui'], |
||
185 | ['who' => 'Marilou', 'when' => 'Entraînement ', 'choice' => 'Oui'], |
||
186 | ['who' => 'Mehdi', 'when' => 'Entraînement ', 'choice' => 'Non'], |
||
187 | ['who' => 'Élodie', 'when' => 'Entraînement ', 'choice' => 'Non'], |
||
188 | ['who' => 'Cécile', 'when' => 'Entraînement ', 'choice' => 'Oui'], |
||
189 | ['who' => 'Vincent', 'when' => 'Entraînement ', 'choice' => 'Oui'], |
||
190 | ['who' => 'Cyril', 'when' => 'Entraînement ', 'choice' => 'Oui'], |
||
191 | ['who' => 'Lucie', 'when' => 'Entraînement ', 'choice' => 'Oui'], |
||
192 | ['who' => 'Jean', 'when' => 'Bruz 2 / Chanteloup 1', 'choice' => 'Oui'], |
||
193 | ['who' => 'Marilou', 'when' => 'Bruz 2 / Chanteloup 1', 'choice' => 'Oui'], |
||
194 | ['who' => 'Mehdi', 'when' => 'Bruz 2 / Chanteloup 1', 'choice' => 'Chauffeur'], |
||
195 | ['who' => 'Élodie', 'when' => 'Bruz 2 / Chanteloup 1', 'choice' => 'Oui'], |
||
196 | ['who' => 'Cécile', 'when' => 'Bruz 2 / Chanteloup 1', 'choice' => 'Non'], |
||
197 | ['who' => 'Vincent', 'when' => 'Bruz 2 / Chanteloup 1', 'choice' => 'Si nécessaire'], |
||
198 | ['who' => 'Patricia', 'when' => 'Bruz 2 / Chanteloup 1', 'choice' => 'Oui'], |
||
199 | ['who' => 'Cyril', 'when' => 'Bruz 2 / Chanteloup 1', 'choice' => 'Chauffeur'], |
||
200 | ]; |
||
201 | $this->resetPoll($manager, 'volleyball', 'Volley', " |
||
202 | Ceci est un sondage d'exemple pour l'organisation de matchs de volley. |
||
203 | N'hésitez pas à l'essayer, mais les données seront automatiquement réinitialisées chaque matin. |
||
204 | Pour créer votre propre sondage, retournez sur la page d'accueil en cliquant sur \"Kyélà \" en haut à gauche. |
||
205 | <ul> |
||
206 | <li><a href='http://umap.openstreetmap.fr/fr/map/volley-35_2960#11/47.9607/-1.6703'>Carte des salles de volley</a></li> |
||
207 | <li>Résultats et planning : <a href='http://www.ffvbbeach.org/ffvbapp/resu/vbspo_calendrier.php?saison=2014/2015&codent=PTBR35&poule=XSH'>Chanteloup 1</a> -- |
||
208 | <a href='http://www.ffvbbeach.org/ffvbapp/resu/vbspo_calendrier.php?saison=2014/2015&codent=PTBR35&poule=XSI'>Chanteloup 2</a></li> |
||
209 | </ul>", '', |
||
210 | $names, $events, $choices, $participations); |
||
211 | } |
||
212 | |||
213 | /** |
||
214 | * @param string $url |
||
215 | * @param string $title |
||
216 | * @param string $headLines |
||
217 | * @param string $bottomLines |
||
218 | * @param string[] $names |
||
219 | */ |
||
220 | protected function resetPoll(ObjectManager $manager, $url, $title, $headLines, $bottomLines, $names, $events, $choices, $participations) |
||
221 | { |
||
222 | $entity = $manager->getRepository('KyelaBundle:Poll')->findOneByUrl($url); |
||
0 ignored issues
–
show
|
|||
223 | if ($entity) { |
||
224 | $manager->remove($entity); |
||
225 | $manager->flush(); |
||
226 | } |
||
227 | |||
228 | $poll = (new Poll) |
||
229 | ->setUrl($url) |
||
230 | ->setTitle($title) |
||
231 | ->setHeadLines($headLines) |
||
232 | ->setBottomLines($bottomLines) |
||
233 | ->setAccessCode('kode'); |
||
234 | $manager->persist($poll); |
||
235 | |||
236 | $participantsObj = []; |
||
237 | foreach ($names as $name) |
||
238 | { |
||
239 | $participant = (new Participant)->setName($name)->setPoll($poll); |
||
240 | $manager->persist($participant); |
||
241 | $participantsObj[$name] = $participant; |
||
242 | } |
||
243 | |||
244 | $eventsObj = []; |
||
245 | foreach ($events as $event) |
||
246 | { |
||
247 | $eventObj = (new Event) |
||
248 | ->setName(isset($event['name']) ? $event['name'] : null) |
||
249 | ->setPlace(isset($event['place']) ? $event['place'] : null) |
||
250 | ->setDate(isset($event['date']) ? $event['date'] : null) |
||
251 | ->setTime(isset($event['time']) ? $event['time'] : null) |
||
252 | ->setPoll($poll); |
||
253 | $manager->persist($eventObj); |
||
254 | $eventsObj[$event['name']] = $eventObj; |
||
255 | } |
||
256 | |||
257 | $choicesObj = []; |
||
258 | foreach ($choices as $choice) |
||
259 | { |
||
260 | $choiceObj = (new Choice) |
||
261 | ->setName($choice['name']) |
||
262 | ->setValue($choice['value']) |
||
263 | ->setColor($choice['color']) |
||
264 | ->setPriority($choice['priority']) |
||
265 | ->setIcon($choice['icon']) |
||
266 | ->setPoll($poll); |
||
267 | $manager->persist($choiceObj); |
||
268 | $choicesObj[$choice['name']] = $choiceObj; |
||
269 | } |
||
270 | |||
271 | foreach ($participations as $row) |
||
272 | { |
||
273 | $participation = (new Participation) |
||
274 | ->setParticipant($participantsObj[$row['who']]) |
||
275 | ->setEvent($eventsObj[$row['when']]) |
||
276 | ->setChoice($choicesObj[$row['choice']]); |
||
277 | $manager->persist($participation); |
||
278 | } |
||
279 | } |
||
280 | |||
281 | /** |
||
282 | * {@inheritDoc} |
||
283 | */ |
||
284 | public function load(ObjectManager $manager) |
||
285 | { |
||
286 | $this->loadConcert($manager); |
||
287 | $this->loadPicnic($manager); |
||
288 | $this->loadHolidays($manager); |
||
289 | $this->loadVolley($manager); |
||
290 | $manager->flush(); |
||
291 | } |
||
292 | } |
||
293 |
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.