|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace SDIS62\Core\Ops\Entity\Engagement; |
|
4
|
|
|
|
|
5
|
|
|
use SDIS62\Core\Ops\Entity\Engagement; |
|
6
|
|
|
use SDIS62\Core\Ops\Entity\Intervention; |
|
7
|
|
|
use SDIS62\Core\Ops\Entity\Materiel; |
|
8
|
|
|
use SDIS62\Core\Ops\Entity\Pompier; |
|
9
|
|
|
|
|
10
|
|
|
class PompierEngagement extends Engagement |
|
11
|
|
|
{ |
|
12
|
|
|
/** |
|
13
|
|
|
* Type. |
|
14
|
|
|
* |
|
15
|
|
|
* @var string |
|
16
|
|
|
*/ |
|
17
|
|
|
protected $type = 'pompier'; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* Pompier associé. |
|
21
|
|
|
* |
|
22
|
|
|
* @var SDIS62\Core\Ops\Entity\Pompier |
|
23
|
|
|
*/ |
|
24
|
|
|
protected $pompier; |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* Matériel engagé. |
|
28
|
|
|
* |
|
29
|
|
|
* @var SDIS62\Core\Ops\Entity\Materiel |
|
30
|
|
|
*/ |
|
31
|
|
|
protected $materiel; |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* Spécialités engagées. |
|
35
|
|
|
* |
|
36
|
|
|
* @var array |
|
37
|
|
|
*/ |
|
38
|
|
|
protected $specialites_engagees; |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* Ajout d'un engagement de type pompier à une intervention. |
|
42
|
|
|
* |
|
43
|
|
|
* @param SDIS62\Core\Ops\Entity\Intervention $intervention |
|
44
|
|
|
* @param SDIS62\Core\Ops\Entity\Materiel $materiel |
|
45
|
|
|
* @param SDIS62\Core\Ops\Entity\Pompier $pompier |
|
46
|
|
|
* @param array $specialites_engagees |
|
47
|
|
|
*/ |
|
48
|
|
|
public function __construct(Intervention $intervention, Materiel $materiel, Pompier $pompier, array $specialites_engagees = []) |
|
49
|
|
|
{ |
|
50
|
|
|
$this->pompier = $pompier; |
|
|
|
|
|
|
51
|
|
|
$this->pompier->addEngagement($this); |
|
52
|
|
|
|
|
53
|
|
|
$this->materiel = $materiel; |
|
|
|
|
|
|
54
|
|
|
$this->materiel->addEngagement($this); |
|
55
|
|
|
|
|
56
|
|
|
$this->specialites_engagees = $specialites_engagees; |
|
57
|
|
|
|
|
58
|
|
|
parent::__construct($intervention, $materiel); |
|
|
|
|
|
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* Get the value of Pompier associé. |
|
63
|
|
|
* |
|
64
|
|
|
* @return SDIS62\Core\Ops\Entity\Pompier |
|
65
|
|
|
*/ |
|
66
|
|
|
public function getPompier() |
|
67
|
|
|
{ |
|
68
|
|
|
return $this->pompier; |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
/** |
|
72
|
|
|
* Spécialitées engagées. |
|
73
|
|
|
* |
|
74
|
|
|
* @return array |
|
75
|
|
|
*/ |
|
76
|
|
|
public function getSpecialitesEngagees() |
|
77
|
|
|
{ |
|
78
|
|
|
if (!($this->getPompier() instanceof Pompier\SpecialistePompier)) { |
|
79
|
|
|
return []; |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
return array_intersect($this->getPompier()->getSpecialites(), $this->specialites_engagees); |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
|
|
/** |
|
86
|
|
|
* Get the value of Matériel engagé. |
|
87
|
|
|
* |
|
88
|
|
|
* @return SDIS62\Core\Ops\Entity\Materiel |
|
89
|
|
|
*/ |
|
90
|
|
|
public function getMateriel() |
|
91
|
|
|
{ |
|
92
|
|
|
return $this->materiel; |
|
93
|
|
|
} |
|
94
|
|
|
} |
|
95
|
|
|
|
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..