1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @file |
4
|
|
|
* Contains \TheSportsDb\Entity\Event. |
5
|
|
|
*/ |
6
|
|
|
|
7
|
|
|
namespace TheSportsDb\Entity; |
8
|
|
|
|
9
|
|
|
use TheSportsDb\Entity\EntityManagerInterface; |
10
|
|
|
use TheSportsDb\PropertyMapper\PropertyDefinition; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* A fully loaded event object. |
14
|
|
|
* |
15
|
|
|
* @author Jelle Sebreghts |
16
|
|
|
*/ |
17
|
|
|
class Event extends Entity implements EventInterface { |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* {@inheritdoc} |
21
|
|
|
*/ |
22
|
|
|
protected static $propertyMapDefinition; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* The primary identifier. |
26
|
|
|
* |
27
|
|
|
* @var mixed |
28
|
|
|
*/ |
29
|
|
|
protected $id; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* The name. |
33
|
|
|
* |
34
|
|
|
* @var string |
35
|
|
|
*/ |
36
|
|
|
protected $name; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* The league of this event. |
40
|
|
|
* |
41
|
|
|
* @var \TheSportsDb\Entity\LeagueInterface |
42
|
|
|
*/ |
43
|
|
|
protected $league; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* The filename. |
47
|
|
|
* |
48
|
|
|
* @var string |
49
|
|
|
*/ |
50
|
|
|
protected $filename; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* The season. |
54
|
|
|
* |
55
|
|
|
* @var \TheSportsDb\Entity\SeasonInterface |
56
|
|
|
*/ |
57
|
|
|
protected $season; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* The description. |
61
|
|
|
* |
62
|
|
|
* @var string |
63
|
|
|
*/ |
64
|
|
|
protected $description; |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* The home score. |
68
|
|
|
* |
69
|
|
|
* @var int |
70
|
|
|
*/ |
71
|
|
|
protected $homeScore; |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* The round. |
75
|
|
|
* |
76
|
|
|
* @var int |
77
|
|
|
*/ |
78
|
|
|
protected $round; |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* The away score. |
82
|
|
|
* |
83
|
|
|
* @var int |
84
|
|
|
*/ |
85
|
|
|
protected $awayScore; |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* The number of specators. |
89
|
|
|
* |
90
|
|
|
* @var int |
91
|
|
|
*/ |
92
|
|
|
protected $specators; |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* The home goal details. |
96
|
|
|
* |
97
|
|
|
* @var string |
98
|
|
|
*/ |
99
|
|
|
protected $homeGoalDetails; |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* The home red cards. |
103
|
|
|
* |
104
|
|
|
* @var string |
105
|
|
|
*/ |
106
|
|
|
protected $homeRedCards; |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* The home yellow cards. |
110
|
|
|
* |
111
|
|
|
* @var string |
112
|
|
|
*/ |
113
|
|
|
protected $homeYellowCards; |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* The home lineup - goalkeeper. |
117
|
|
|
* |
118
|
|
|
* @var string |
119
|
|
|
*/ |
120
|
|
|
protected $homeLineupGoalkeeper; |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* The home lineup - defense. |
124
|
|
|
* |
125
|
|
|
* @var string |
126
|
|
|
*/ |
127
|
|
|
protected $homeLineupDefense; |
128
|
|
|
|
129
|
|
|
/** |
130
|
|
|
* The home lineup - midfield. |
131
|
|
|
* |
132
|
|
|
* @var string |
133
|
|
|
*/ |
134
|
|
|
protected $homeLineupMidfield; |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* The home lineup - forward. |
138
|
|
|
* |
139
|
|
|
* @var string |
140
|
|
|
*/ |
141
|
|
|
protected $homeLineupForward; |
142
|
|
|
|
143
|
|
|
/** |
144
|
|
|
* The home lineup - substitutes. |
145
|
|
|
* |
146
|
|
|
* @var string |
147
|
|
|
*/ |
148
|
|
|
protected $homeLineupSubstitutes; |
149
|
|
|
|
150
|
|
|
/** |
151
|
|
|
* The home formation. |
152
|
|
|
* |
153
|
|
|
* @var string |
154
|
|
|
*/ |
155
|
|
|
protected $homeFormation; |
156
|
|
|
|
157
|
|
|
/** |
158
|
|
|
* The away red cards. |
159
|
|
|
* |
160
|
|
|
* @var string |
161
|
|
|
*/ |
162
|
|
|
protected $awayRedCards; |
163
|
|
|
|
164
|
|
|
/** |
165
|
|
|
* The away yellow cards. |
166
|
|
|
* |
167
|
|
|
* @var string |
168
|
|
|
*/ |
169
|
|
|
protected $awayYellowCards; |
170
|
|
|
|
171
|
|
|
/** |
172
|
|
|
* The away goal details. |
173
|
|
|
* |
174
|
|
|
* @var string |
175
|
|
|
*/ |
176
|
|
|
protected $awayGoalDetails; |
177
|
|
|
|
178
|
|
|
/** |
179
|
|
|
* The away lineup - goalkeeper. |
180
|
|
|
* |
181
|
|
|
* @var string |
182
|
|
|
*/ |
183
|
|
|
protected $awayLineupGoalkeeper; |
184
|
|
|
|
185
|
|
|
/** |
186
|
|
|
* The away lineup - defense. |
187
|
|
|
* |
188
|
|
|
* @var string |
189
|
|
|
*/ |
190
|
|
|
protected $awayLineupDefense; |
191
|
|
|
|
192
|
|
|
/** |
193
|
|
|
* The away lineup - midfield. |
194
|
|
|
* |
195
|
|
|
* @var string |
196
|
|
|
*/ |
197
|
|
|
protected $awayLineupMidfield; |
198
|
|
|
|
199
|
|
|
/** |
200
|
|
|
* The away lineup - forward. |
201
|
|
|
* |
202
|
|
|
* @var string |
203
|
|
|
*/ |
204
|
|
|
protected $awayLineupForward; |
205
|
|
|
|
206
|
|
|
/** |
207
|
|
|
* The away lineup - substitutes. |
208
|
|
|
* |
209
|
|
|
* @var string |
210
|
|
|
*/ |
211
|
|
|
protected $awayLineupSubstitutes; |
212
|
|
|
|
213
|
|
|
/** |
214
|
|
|
* The away formation. |
215
|
|
|
* |
216
|
|
|
* @var string |
217
|
|
|
*/ |
218
|
|
|
protected $awayFormation; |
219
|
|
|
|
220
|
|
|
/** |
221
|
|
|
* The home shots. |
222
|
|
|
* |
223
|
|
|
* @var int |
224
|
|
|
*/ |
225
|
|
|
protected $homeShots; |
226
|
|
|
|
227
|
|
|
/** |
228
|
|
|
* The away shots. |
229
|
|
|
* |
230
|
|
|
* @var int |
231
|
|
|
*/ |
232
|
|
|
protected $awayShots; |
233
|
|
|
|
234
|
|
|
/** |
235
|
|
|
* The date. |
236
|
|
|
* |
237
|
|
|
* @var string |
238
|
|
|
*/ |
239
|
|
|
protected $date; |
240
|
|
|
|
241
|
|
|
/** |
242
|
|
|
* The TV station. |
243
|
|
|
* |
244
|
|
|
* @var string |
245
|
|
|
*/ |
246
|
|
|
protected $tvStation; |
247
|
|
|
|
248
|
|
|
/** |
249
|
|
|
* The home team. |
250
|
|
|
* |
251
|
|
|
* @var \TheSportsDb\Entity\TeamInterface |
252
|
|
|
*/ |
253
|
|
|
protected $homeTeam; |
254
|
|
|
|
255
|
|
|
/** |
256
|
|
|
* The away team. |
257
|
|
|
* |
258
|
|
|
* @var \TheSportsDb\Entity\TeamInterface |
259
|
|
|
*/ |
260
|
|
|
protected $awayTeam; |
261
|
|
|
|
262
|
|
|
/** |
263
|
|
|
* The result. |
264
|
|
|
* |
265
|
|
|
* @var string |
266
|
|
|
*/ |
267
|
|
|
protected $result; |
268
|
|
|
|
269
|
|
|
/** |
270
|
|
|
* The circuit. |
271
|
|
|
* |
272
|
|
|
* @var string |
273
|
|
|
*/ |
274
|
|
|
protected $circuit; |
275
|
|
|
|
276
|
|
|
/** |
277
|
|
|
* The country. |
278
|
|
|
* |
279
|
|
|
* @var string |
280
|
|
|
*/ |
281
|
|
|
protected $country; |
282
|
|
|
|
283
|
|
|
/** |
284
|
|
|
* The city. |
285
|
|
|
* |
286
|
|
|
* @var string |
287
|
|
|
*/ |
288
|
|
|
protected $city; |
289
|
|
|
|
290
|
|
|
/** |
291
|
|
|
* The poster URL. |
292
|
|
|
* |
293
|
|
|
* @var string |
294
|
|
|
*/ |
295
|
|
|
protected $poster; |
296
|
|
|
|
297
|
|
|
/** |
298
|
|
|
* The thumbnail URL. |
299
|
|
|
* |
300
|
|
|
* @var string |
301
|
|
|
*/ |
302
|
|
|
protected $thumb; |
303
|
|
|
|
304
|
|
|
/** |
305
|
|
|
* The banner URL. |
306
|
|
|
* |
307
|
|
|
* @var string |
308
|
|
|
*/ |
309
|
|
|
protected $banner; |
310
|
|
|
|
311
|
|
|
/** |
312
|
|
|
* The map URL. |
313
|
|
|
* |
314
|
|
|
* @var string |
315
|
|
|
*/ |
316
|
|
|
protected $map; |
317
|
|
|
|
318
|
|
|
/** |
319
|
|
|
* Whether this player is locked or not. |
320
|
|
|
* |
321
|
|
|
* @var string |
322
|
|
|
*/ |
323
|
|
|
protected $locked; |
324
|
|
|
|
325
|
|
|
/** |
326
|
|
|
* {@inheritdoc} |
327
|
|
|
*/ |
328
|
1 |
|
public function getId() { |
329
|
1 |
|
return $this->id; |
330
|
|
|
} |
331
|
|
|
|
332
|
|
|
/** |
333
|
|
|
* {@inheritdoc} |
334
|
|
|
*/ |
335
|
1 |
|
public function getName() { |
336
|
1 |
|
return $this->name; |
337
|
|
|
} |
338
|
|
|
|
339
|
|
|
/** |
340
|
|
|
* {@inheritdoc} |
341
|
|
|
*/ |
342
|
1 |
|
public function getLeague() { |
343
|
1 |
|
return $this->league; |
344
|
|
|
} |
345
|
|
|
|
346
|
|
|
/** |
347
|
|
|
* {@inheritdoc} |
348
|
|
|
*/ |
349
|
1 |
|
public function getFilename() { |
350
|
1 |
|
return $this->filename; |
351
|
|
|
} |
352
|
|
|
|
353
|
|
|
/** |
354
|
|
|
* {@inheritdoc} |
355
|
|
|
*/ |
356
|
1 |
|
public function getSeason() { |
357
|
1 |
|
return $this->season; |
358
|
|
|
} |
359
|
|
|
|
360
|
|
|
/** |
361
|
|
|
* {@inheritdoc} |
362
|
|
|
*/ |
363
|
1 |
|
public function getDescription() { |
364
|
1 |
|
return $this->description; |
365
|
|
|
} |
366
|
|
|
|
367
|
|
|
/** |
368
|
|
|
* {@inheritdoc} |
369
|
|
|
*/ |
370
|
1 |
|
public function getHomeScore() { |
371
|
1 |
|
return $this->homeScore; |
372
|
|
|
} |
373
|
|
|
|
374
|
|
|
/** |
375
|
|
|
* {@inheritdoc} |
376
|
|
|
*/ |
377
|
1 |
|
public function getRound() { |
378
|
1 |
|
return $this->round; |
379
|
|
|
} |
380
|
|
|
|
381
|
|
|
/** |
382
|
|
|
* {@inheritdoc} |
383
|
|
|
*/ |
384
|
1 |
|
public function getAwayScore() { |
385
|
1 |
|
return $this->awayScore; |
386
|
|
|
} |
387
|
|
|
|
388
|
|
|
/** |
389
|
|
|
* {@inheritdoc} |
390
|
|
|
*/ |
391
|
1 |
|
public function getSpecators() { |
392
|
1 |
|
return $this->specators; |
393
|
|
|
} |
394
|
|
|
|
395
|
|
|
/** |
396
|
|
|
* {@inheritdoc} |
397
|
|
|
*/ |
398
|
1 |
|
public function getHomeGoalDetails() { |
399
|
1 |
|
return $this->homeGoalDetails; |
400
|
|
|
} |
401
|
|
|
|
402
|
|
|
/** |
403
|
|
|
* {@inheritdoc} |
404
|
|
|
*/ |
405
|
1 |
|
public function getHomeRedCards() { |
406
|
1 |
|
return $this->homeRedCards; |
407
|
|
|
} |
408
|
|
|
|
409
|
|
|
/** |
410
|
|
|
* {@inheritdoc} |
411
|
|
|
*/ |
412
|
1 |
|
public function getHomeYellowCards() { |
413
|
1 |
|
return $this->homeYellowCards; |
414
|
|
|
} |
415
|
|
|
|
416
|
|
|
/** |
417
|
|
|
* {@inheritdoc} |
418
|
|
|
*/ |
419
|
1 |
|
public function getHomeLineupGoalkeeper() { |
420
|
1 |
|
return $this->homeLineupGoalkeeper; |
421
|
|
|
} |
422
|
|
|
|
423
|
|
|
/** |
424
|
|
|
* {@inheritdoc} |
425
|
|
|
*/ |
426
|
1 |
|
public function getHomeLineupDefense() { |
427
|
1 |
|
return $this->homeLineupDefense; |
428
|
|
|
} |
429
|
|
|
|
430
|
|
|
/** |
431
|
|
|
* {@inheritdoc} |
432
|
|
|
*/ |
433
|
1 |
|
public function getHomeLineupMidfield() { |
434
|
1 |
|
return $this->homeLineupMidfield; |
435
|
|
|
} |
436
|
|
|
|
437
|
|
|
/** |
438
|
|
|
* {@inheritdoc} |
439
|
|
|
*/ |
440
|
1 |
|
public function getHomeLineupForward() { |
441
|
1 |
|
return $this->homeLineupForward; |
442
|
|
|
} |
443
|
|
|
|
444
|
|
|
/** |
445
|
|
|
* {@inheritdoc} |
446
|
|
|
*/ |
447
|
1 |
|
public function getHomeLineupSubstitutes() { |
448
|
1 |
|
return $this->homeLineupSubstitutes; |
449
|
|
|
} |
450
|
|
|
|
451
|
|
|
/** |
452
|
|
|
* {@inheritdoc} |
453
|
|
|
*/ |
454
|
1 |
|
public function getHomeFormation() { |
455
|
1 |
|
return $this->homeFormation; |
456
|
|
|
} |
457
|
|
|
|
458
|
|
|
/** |
459
|
|
|
* {@inheritdoc} |
460
|
|
|
*/ |
461
|
1 |
|
public function getAwayRedCards() { |
462
|
1 |
|
return $this->awayRedCards; |
463
|
|
|
} |
464
|
|
|
|
465
|
|
|
/** |
466
|
|
|
* {@inheritdoc} |
467
|
|
|
*/ |
468
|
1 |
|
public function getAwayYellowCards() { |
469
|
1 |
|
return $this->awayYellowCards; |
470
|
|
|
} |
471
|
|
|
|
472
|
|
|
/** |
473
|
|
|
* {@inheritdoc} |
474
|
|
|
*/ |
475
|
1 |
|
public function getAwayGoalDetails() { |
476
|
1 |
|
return $this->awayGoalDetails; |
477
|
|
|
} |
478
|
|
|
|
479
|
|
|
/** |
480
|
|
|
* {@inheritdoc} |
481
|
|
|
*/ |
482
|
1 |
|
public function getAwayLineupGoalkeeper() { |
483
|
1 |
|
return $this->awayLineupGoalkeeper; |
484
|
|
|
} |
485
|
|
|
|
486
|
|
|
/** |
487
|
|
|
* {@inheritdoc} |
488
|
|
|
*/ |
489
|
1 |
|
public function getAwayLineupDefense() { |
490
|
1 |
|
return $this->awayLineupDefense; |
491
|
|
|
} |
492
|
|
|
|
493
|
|
|
/** |
494
|
|
|
* {@inheritdoc} |
495
|
|
|
*/ |
496
|
1 |
|
public function getAwayLineupMidfield() { |
497
|
1 |
|
return $this->awayLineupMidfield; |
498
|
|
|
} |
499
|
|
|
|
500
|
|
|
/** |
501
|
|
|
* {@inheritdoc} |
502
|
|
|
*/ |
503
|
1 |
|
public function getAwayLineupForward() { |
504
|
1 |
|
return $this->awayLineupForward; |
505
|
|
|
} |
506
|
|
|
|
507
|
|
|
/** |
508
|
|
|
* {@inheritdoc} |
509
|
|
|
*/ |
510
|
1 |
|
public function getAwayLineupSubstitutes() { |
511
|
1 |
|
return $this->awayLineupSubstitutes; |
512
|
|
|
} |
513
|
|
|
|
514
|
|
|
/** |
515
|
|
|
* {@inheritdoc} |
516
|
|
|
*/ |
517
|
1 |
|
public function getAwayFormation() { |
518
|
1 |
|
return $this->awayFormation; |
519
|
|
|
} |
520
|
|
|
|
521
|
|
|
/** |
522
|
|
|
* {@inheritdoc} |
523
|
|
|
*/ |
524
|
1 |
|
public function getHomeShots() { |
525
|
1 |
|
return $this->homeShots; |
526
|
|
|
} |
527
|
|
|
|
528
|
|
|
/** |
529
|
|
|
* {@inheritdoc} |
530
|
|
|
*/ |
531
|
1 |
|
public function getAwayShots() { |
532
|
1 |
|
return $this->awayShots; |
533
|
|
|
} |
534
|
|
|
|
535
|
|
|
/** |
536
|
|
|
* {@inheritdoc} |
537
|
|
|
*/ |
538
|
1 |
|
public function getDate() { |
539
|
1 |
|
return $this->date; |
540
|
|
|
} |
541
|
|
|
|
542
|
|
|
/** |
543
|
|
|
* {@inheritdoc} |
544
|
|
|
*/ |
545
|
1 |
|
public function getTvStation() { |
546
|
1 |
|
return $this->tvStation; |
547
|
|
|
} |
548
|
|
|
|
549
|
|
|
/** |
550
|
|
|
* {@inheritdoc} |
551
|
|
|
*/ |
552
|
1 |
|
public function getHomeTeam() { |
553
|
1 |
|
return $this->homeTeam; |
554
|
|
|
} |
555
|
|
|
|
556
|
|
|
/** |
557
|
|
|
* {@inheritdoc} |
558
|
|
|
*/ |
559
|
1 |
|
public function getAwayTeam() { |
560
|
1 |
|
return $this->awayTeam; |
561
|
|
|
} |
562
|
|
|
|
563
|
|
|
/** |
564
|
|
|
* {@inheritdoc} |
565
|
|
|
*/ |
566
|
1 |
|
public function getResult() { |
567
|
1 |
|
return $this->result; |
568
|
|
|
} |
569
|
|
|
|
570
|
|
|
/** |
571
|
|
|
* {@inheritdoc} |
572
|
|
|
*/ |
573
|
1 |
|
public function getCircuit() { |
574
|
1 |
|
return $this->circuit; |
575
|
|
|
} |
576
|
|
|
|
577
|
|
|
/** |
578
|
|
|
* {@inheritdoc} |
579
|
|
|
*/ |
580
|
1 |
|
public function getCountry() { |
581
|
1 |
|
return $this->country; |
582
|
|
|
} |
583
|
|
|
|
584
|
|
|
/** |
585
|
|
|
* {@inheritdoc} |
586
|
|
|
*/ |
587
|
1 |
|
public function getCity() { |
588
|
1 |
|
return $this->city; |
589
|
|
|
} |
590
|
|
|
|
591
|
|
|
/** |
592
|
|
|
* {@inheritdoc} |
593
|
|
|
*/ |
594
|
1 |
|
public function getPoster() { |
595
|
1 |
|
return $this->poster; |
596
|
|
|
} |
597
|
|
|
|
598
|
|
|
/** |
599
|
|
|
* {@inheritdoc} |
600
|
|
|
*/ |
601
|
1 |
|
public function getThumb() { |
602
|
1 |
|
return $this->thumb; |
603
|
|
|
} |
604
|
|
|
|
605
|
|
|
/** |
606
|
|
|
* {@inheritdoc} |
607
|
|
|
*/ |
608
|
1 |
|
public function getBanner() { |
609
|
1 |
|
return $this->banner; |
610
|
|
|
} |
611
|
|
|
|
612
|
|
|
/** |
613
|
|
|
* {@inheritdoc} |
614
|
|
|
*/ |
615
|
1 |
|
public function getMap() { |
616
|
1 |
|
return $this->map; |
617
|
|
|
} |
618
|
|
|
|
619
|
|
|
/** |
620
|
|
|
* {@inheritdoc} |
621
|
|
|
*/ |
622
|
1 |
|
public function getLocked() { |
623
|
1 |
|
return $this->locked; |
624
|
|
|
} |
625
|
|
|
|
626
|
|
|
/** |
627
|
|
|
* Transforms the league property to a league entity. |
628
|
|
|
* |
629
|
|
|
* @param mixed $value |
630
|
|
|
* The source value of the league property. |
631
|
|
|
* @param \stdClass $context |
632
|
|
|
* The source object representing this event. |
633
|
|
|
* @param EntityManagerInterface $entityManager |
634
|
|
|
* The entity manager. |
635
|
|
|
* |
636
|
|
|
* @return \TheSportsDb\Entity\LeagueInterface |
637
|
|
|
* The league entity. |
638
|
|
|
*/ |
639
|
1 |
|
public static function transformLeague($value, $context, EntityManagerInterface $entityManager) { |
640
|
1 |
|
return static::transform($value, $context, $entityManager, 'league', 'idLeague', array('strLeague' => 'strLeague')); |
641
|
|
|
} |
642
|
|
|
|
643
|
|
|
/** |
644
|
|
|
* Transforms the season property to a season entity. |
645
|
|
|
* |
646
|
|
|
* @param mixed $value |
647
|
|
|
* The source value of the season property. |
648
|
|
|
* @param \stdClass $context |
649
|
|
|
* The source object representing this event. |
650
|
|
|
* @param EntityManagerInterface $entityManager |
651
|
|
|
* The entity manager. |
652
|
|
|
* |
653
|
|
|
* @return \TheSportsDb\Entity\SeasonInterface |
654
|
|
|
* The season entity. |
655
|
|
|
*/ |
656
|
1 |
|
public static function transformSeason($value, $context, EntityManagerInterface $entityManager) { |
657
|
1 |
|
$season = is_object($value) ? $value : (object) array('idLeague' => $context->idLeague, 'strSeason' => $value); |
658
|
1 |
|
$id = $season->strSeason . '|' . $season->idLeague; |
659
|
1 |
|
$seasonEntity = $entityManager->repository('season')->byId($id); |
660
|
1 |
|
$seasonEntity->update($season); |
661
|
1 |
|
return $seasonEntity; |
662
|
|
|
} |
663
|
|
|
|
664
|
|
|
/** |
665
|
|
|
* Transforms the home team property to a team entity. |
666
|
|
|
* |
667
|
|
|
* @param mixed $value |
668
|
|
|
* The source value of the home team property. |
669
|
|
|
* @param \stdClass $context |
670
|
|
|
* The source object representing this event. |
671
|
|
|
* @param EntityManagerInterface $entityManager |
672
|
|
|
* The entity manager. |
673
|
|
|
* |
674
|
|
|
* @return \TheSportsDb\Entity\TeamInterface |
675
|
|
|
* The team entity. |
676
|
|
|
*/ |
677
|
1 |
|
public static function transformHomeTeam($value, $context, EntityManagerInterface $entityManager) { |
678
|
1 |
|
return static::transform($value, $context, $entityManager, 'team', 'idTeam', array('strHomeTeam' => 'strTeam')); |
679
|
|
|
} |
680
|
|
|
|
681
|
|
|
/** |
682
|
|
|
* Transforms the away team property to a team entity. |
683
|
|
|
* |
684
|
|
|
* @param mixed $value |
685
|
|
|
* The source value of the away team property. |
686
|
|
|
* @param \stdClass $context |
687
|
|
|
* The source object representing this event. |
688
|
|
|
* @param EntityManagerInterface $entityManager |
689
|
|
|
* The entity manager. |
690
|
|
|
* |
691
|
|
|
* @return \TheSportsDb\Entity\TeamInterface |
692
|
|
|
* The team entity. |
693
|
|
|
*/ |
694
|
1 |
|
public static function transformAwayTeam($value, $context, EntityManagerInterface $entityManager) { |
695
|
1 |
|
return static::transform($value, $context, $entityManager, 'team', 'idTeam', array('strAwayTeam' => 'strTeam')); |
696
|
|
|
} |
697
|
|
|
|
698
|
|
|
/** |
699
|
|
|
* {@inhertidoc} |
700
|
|
|
*/ |
701
|
1 |
|
protected static function initPropertyMapDefinition() { |
702
|
1 |
|
static::$propertyMapDefinition |
703
|
1 |
|
->addPropertyMap( |
704
|
1 |
|
new PropertyDefinition('idEvent'), |
705
|
1 |
|
new PropertyDefinition('id') |
706
|
|
|
) |
707
|
1 |
|
->addPropertyMap( |
708
|
1 |
|
new PropertyDefinition('strEvent'), |
709
|
1 |
|
new PropertyDefinition('name') |
710
|
|
|
) |
711
|
1 |
|
->addPropertyMap( |
712
|
1 |
|
new PropertyDefinition('strFilename'), |
713
|
1 |
|
new PropertyDefinition('filename') |
714
|
|
|
) |
715
|
1 |
|
->addPropertyMap( |
716
|
1 |
|
new PropertyDefinition('idLeague'), |
717
|
1 |
|
new PropertyDefinition('league', 'league'), |
718
|
1 |
|
[static::class, 'transformLeague'], |
719
|
1 |
|
[League::class, 'reverse'] |
720
|
|
|
) |
721
|
1 |
|
->addPropertyMap( |
722
|
1 |
|
new PropertyDefinition('strSeason'), |
723
|
1 |
|
new PropertyDefinition('season', 'season'), |
724
|
1 |
|
[static::class, 'transformSeason'], |
725
|
1 |
|
[Season::class, 'reverse'] |
726
|
|
|
) |
727
|
1 |
|
->addPropertyMap( |
728
|
1 |
|
new PropertyDefinition('strDescriptionEN'), |
729
|
1 |
|
new PropertyDefinition('description') |
730
|
|
|
) |
731
|
1 |
|
->addPropertyMap( |
732
|
1 |
|
new PropertyDefinition('intHomeScore'), |
733
|
1 |
|
new PropertyDefinition('homeScore') |
734
|
|
|
) |
735
|
1 |
|
->addPropertyMap( |
736
|
1 |
|
new PropertyDefinition('intRound'), |
737
|
1 |
|
new PropertyDefinition('round') |
738
|
|
|
) |
739
|
1 |
|
->addPropertyMap( |
740
|
1 |
|
new PropertyDefinition('intAwayScore'), |
741
|
1 |
|
new PropertyDefinition('awayScore') |
742
|
|
|
) |
743
|
1 |
|
->addPropertyMap( |
744
|
1 |
|
new PropertyDefinition('intSpectators'), |
745
|
1 |
|
new PropertyDefinition('spectators') |
746
|
|
|
) |
747
|
1 |
|
->addPropertyMap( |
748
|
1 |
|
new PropertyDefinition('strHomeGoalDetails'), |
749
|
1 |
|
new PropertyDefinition('homeGoalDetails') |
750
|
|
|
) |
751
|
1 |
|
->addPropertyMap( |
752
|
1 |
|
new PropertyDefinition('strHomeRedCards'), |
753
|
1 |
|
new PropertyDefinition('homeRedCards') |
754
|
|
|
) |
755
|
1 |
|
->addPropertyMap( |
756
|
1 |
|
new PropertyDefinition('strHomeYellowCards'), |
757
|
1 |
|
new PropertyDefinition('homeYellowCards') |
758
|
|
|
) |
759
|
1 |
|
->addPropertyMap( |
760
|
1 |
|
new PropertyDefinition('strHomeLineupGoalkeeper'), |
761
|
1 |
|
new PropertyDefinition('homeLineupGoalkeeper') |
762
|
|
|
) |
763
|
1 |
|
->addPropertyMap( |
764
|
1 |
|
new PropertyDefinition('strHomeLineupDefense'), |
765
|
1 |
|
new PropertyDefinition('homeLineupDefense') |
766
|
|
|
) |
767
|
1 |
|
->addPropertyMap( |
768
|
1 |
|
new PropertyDefinition('strHomeLineupMidfield'), |
769
|
1 |
|
new PropertyDefinition('homeLineupMidfield') |
770
|
|
|
) |
771
|
1 |
|
->addPropertyMap( |
772
|
1 |
|
new PropertyDefinition('strHomeLineupForward'), |
773
|
1 |
|
new PropertyDefinition('homeLineupForward') |
774
|
|
|
) |
775
|
1 |
|
->addPropertyMap( |
776
|
1 |
|
new PropertyDefinition('strHomeLineupSubstitutes'), |
777
|
1 |
|
new PropertyDefinition('homeLineupSubstitutes') |
778
|
|
|
) |
779
|
1 |
|
->addPropertyMap( |
780
|
1 |
|
new PropertyDefinition('strHomeLineupFormation'), |
781
|
1 |
|
new PropertyDefinition('homeLineupFormation') |
782
|
|
|
) |
783
|
1 |
|
->addPropertyMap( |
784
|
1 |
|
new PropertyDefinition('intHomeShots'), |
785
|
1 |
|
new PropertyDefinition('homeShots') |
786
|
|
|
) |
787
|
1 |
|
->addPropertyMap( |
788
|
1 |
|
new PropertyDefinition('strAwayGoalDetails'), |
789
|
1 |
|
new PropertyDefinition('awayGoalDetails') |
790
|
|
|
) |
791
|
1 |
|
->addPropertyMap( |
792
|
1 |
|
new PropertyDefinition('strAwayRedCards'), |
793
|
1 |
|
new PropertyDefinition('awayRedCards') |
794
|
|
|
) |
795
|
1 |
|
->addPropertyMap( |
796
|
1 |
|
new PropertyDefinition('strAwayYellowCards'), |
797
|
1 |
|
new PropertyDefinition('awayYellowCards') |
798
|
|
|
) |
799
|
1 |
|
->addPropertyMap( |
800
|
1 |
|
new PropertyDefinition('strAwayLineupGoalkeeper'), |
801
|
1 |
|
new PropertyDefinition('awayLineupGoalkeeper') |
802
|
|
|
) |
803
|
1 |
|
->addPropertyMap( |
804
|
1 |
|
new PropertyDefinition('strAwayLineupDefense'), |
805
|
1 |
|
new PropertyDefinition('awayLineupDefense') |
806
|
|
|
) |
807
|
1 |
|
->addPropertyMap( |
808
|
1 |
|
new PropertyDefinition('strAwayLineupMidfield'), |
809
|
1 |
|
new PropertyDefinition('awayLineupMidfield') |
810
|
|
|
) |
811
|
1 |
|
->addPropertyMap( |
812
|
1 |
|
new PropertyDefinition('strAwayLineupForward'), |
813
|
1 |
|
new PropertyDefinition('awayLineupForward') |
814
|
|
|
) |
815
|
1 |
|
->addPropertyMap( |
816
|
1 |
|
new PropertyDefinition('strAwayLineupSubstitutes'), |
817
|
1 |
|
new PropertyDefinition('awayLineupSubstitutes') |
818
|
|
|
) |
819
|
1 |
|
->addPropertyMap( |
820
|
1 |
|
new PropertyDefinition('strAwayLineupFormation'), |
821
|
1 |
|
new PropertyDefinition('awayLineupFormation') |
822
|
|
|
) |
823
|
1 |
|
->addPropertyMap( |
824
|
1 |
|
new PropertyDefinition('intAwayShots'), |
825
|
1 |
|
new PropertyDefinition('awayShots') |
826
|
|
|
) |
827
|
1 |
|
->addPropertyMap( |
828
|
1 |
|
new PropertyDefinition('strTime'), |
829
|
1 |
|
new PropertyDefinition('time'), |
830
|
|
|
[self::class, 'transformEventTime'], |
831
|
1 |
|
[self::class, 'reverseEventTime'] |
832
|
1 |
|
) |
833
|
1 |
|
->addPropertyMap( |
834
|
|
|
new PropertyDefinition('dateEvent'), |
835
|
1 |
|
new PropertyDefinition('date'), |
836
|
1 |
|
[self::class, 'transformDateEvent'], |
837
|
1 |
|
[self::class, 'reverseDateDefault'] |
838
|
1 |
|
) |
839
|
1 |
|
->addPropertyMap( |
840
|
|
|
new PropertyDefinition('strTVStation'), |
841
|
1 |
|
new PropertyDefinition('tvStation') |
842
|
1 |
|
) |
843
|
1 |
|
->addPropertyMap( |
844
|
1 |
|
new PropertyDefinition('idHomeTeam'), |
845
|
1 |
|
new PropertyDefinition('homeTeam', 'team'), |
846
|
|
|
[static::class, 'transformHomeTeam'], |
847
|
1 |
|
[Team::class, 'reverse'] |
848
|
1 |
|
) |
849
|
1 |
|
->addPropertyMap( |
850
|
|
|
new PropertyDefinition('idAwayTeam'), |
851
|
1 |
|
new PropertyDefinition('awayTeam', 'team'), |
852
|
1 |
|
[self::class, 'transformAwayTeam'], |
853
|
1 |
|
[Team::class, 'reverse'] |
854
|
|
|
) |
855
|
1 |
|
->addPropertyMap( |
856
|
1 |
|
new PropertyDefinition('strResult'), |
857
|
1 |
|
new PropertyDefinition('result') |
858
|
|
|
) |
859
|
1 |
|
->addPropertyMap( |
860
|
1 |
|
new PropertyDefinition('strCircuit'), |
861
|
1 |
|
new PropertyDefinition('circuit') |
862
|
|
|
) |
863
|
1 |
|
->addPropertyMap( |
864
|
1 |
|
new PropertyDefinition('strCountry'), |
865
|
1 |
|
new PropertyDefinition('country') |
866
|
|
|
) |
867
|
1 |
|
->addPropertyMap( |
868
|
1 |
|
new PropertyDefinition('strCity'), |
869
|
1 |
|
new PropertyDefinition('city') |
870
|
|
|
) |
871
|
1 |
|
->addPropertyMap( |
872
|
1 |
|
new PropertyDefinition('strPoster'), |
873
|
1 |
|
new PropertyDefinition('poster') |
874
|
|
|
) |
875
|
1 |
|
->addPropertyMap( |
876
|
1 |
|
new PropertyDefinition('strThumb'), |
877
|
1 |
|
new PropertyDefinition('thumb') |
878
|
|
|
) |
879
|
1 |
|
->addPropertyMap( |
880
|
1 |
|
new PropertyDefinition('strBanner'), |
881
|
1 |
|
new PropertyDefinition('banner') |
882
|
|
|
) |
883
|
|
|
->addPropertyMap( |
884
|
|
|
new PropertyDefinition('strMap'), |
885
|
|
|
new PropertyDefinition('map') |
886
|
|
|
) |
887
|
|
|
->addPropertyMap( |
888
|
|
|
new PropertyDefinition('strLocked'), |
889
|
1 |
|
new PropertyDefinition('locked') |
890
|
|
|
); |
891
|
|
|
// idSoccerXML |
892
|
|
|
// strLeague |
893
|
|
|
// strHomeTeam |
894
|
|
|
// strAwayTeam |
895
|
|
|
// strFanart |
896
|
|
|
// strTime |
897
|
|
|
} |
898
|
|
|
|
899
|
|
|
public static function transformDateEvent($value, $context) { |
900
|
|
|
$pos = strpos($context->strTime, '+'); |
901
|
|
|
return static::transformDateTime($value, 'Y-m-d', $pos === FALSE ? $context->strTime : substr($context->strTime, 0, $pos)); |
902
|
|
|
} |
903
|
|
|
|
904
|
|
|
public static function transformEventTime($value) { |
|
|
|
|
905
|
|
|
} |
906
|
|
|
|
907
|
|
|
public static function reverseEventTime($value, Event $context) { |
|
|
|
|
908
|
|
|
return $context->getDate()->format('H:i:s'); |
|
|
|
|
909
|
|
|
} |
910
|
|
|
|
911
|
|
|
} |
912
|
|
|
|
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.