1 | <?php |
||
17 | class Sport extends Entity implements SportInterface { |
||
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 leagues of this sport. |
||
40 | * |
||
41 | * @var \TheSportsDb\Entity\LeagueInterface[] |
||
42 | */ |
||
43 | protected $leagues = array(); |
||
44 | |||
45 | /** |
||
46 | * {@inheritdoc} |
||
47 | */ |
||
48 | 1 | public function getId() { |
|
51 | |||
52 | /** |
||
53 | * {@inheritdoc} |
||
54 | */ |
||
55 | 1 | public function getName() { |
|
58 | |||
59 | /** |
||
60 | * {@inheritdoc} |
||
61 | */ |
||
62 | 1 | public function getLeagues() { |
|
65 | |||
66 | /** |
||
67 | * {@inheritdoc} |
||
68 | */ |
||
69 | 1 | public function addLeague(LeagueInterface $league) { |
|
70 | 1 | if (!isset($this->leagues[$league->getId()])) { |
|
71 | 1 | $this->leagues[$league->getId()] = $league; |
|
72 | } |
||
73 | 1 | } |
|
74 | |||
75 | /** |
||
76 | * Transforms the leagues property to league entities. |
||
77 | * |
||
78 | * @param array $values |
||
79 | * The source value of the leagues property. |
||
80 | * @param \stdClass $context |
||
81 | * The source object representing this sport. |
||
82 | * @param EntityManagerInterface $entityManager |
||
83 | * The entity manager. |
||
84 | * |
||
85 | * @return \TheSportsDb\Entity\LeagueInterface[] |
||
86 | * The league entities. |
||
87 | */ |
||
88 | public static function transformLeagues($values, $context, EntityManagerInterface $entityManager) { |
||
95 | |||
96 | /** |
||
97 | * {@inheritdoc} |
||
98 | */ |
||
99 | 1 | protected static function initPropertyMapDefinition() { |
|
116 | |||
117 | } |
||
118 |