|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace VideoGamesRecords\CoreBundle\Entity; |
|
4
|
|
|
|
|
5
|
|
|
use ApiPlatform\Core\Annotation\ApiFilter; |
|
6
|
|
|
use ApiPlatform\Core\Annotation\ApiResource; |
|
7
|
|
|
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\DateFilter; |
|
8
|
|
|
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\OrderFilter; |
|
9
|
|
|
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter; |
|
10
|
|
|
use ApiPlatform\Core\Serializer\Filter\GroupFilter; |
|
11
|
|
|
use DateTime; |
|
12
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
13
|
|
|
use Gedmo\Timestampable\Traits\TimestampableEntity; |
|
14
|
|
|
use phpDocumentor\Reflection\Types\Static_; |
|
|
|
|
|
|
15
|
|
|
use VideoGamesRecords\CoreBundle\Contracts\BadgeInterface; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* PlayerGame |
|
19
|
|
|
* |
|
20
|
|
|
* @ORM\Table(name="vgr_player_badge") |
|
21
|
|
|
* @ORM\Entity(repositoryClass="VideoGamesRecords\CoreBundle\Repository\PlayerBadgeRepository") |
|
22
|
|
|
* @ApiFilter( |
|
23
|
|
|
* SearchFilter::class, |
|
24
|
|
|
* properties={ |
|
25
|
|
|
* "player": "exact", |
|
26
|
|
|
* "badge": "exact", |
|
27
|
|
|
* "badge.type": "exact", |
|
28
|
|
|
* } |
|
29
|
|
|
*) |
|
30
|
|
|
* @ApiFilter(DateFilter::class, properties={"ended_at": DateFilter::INCLUDE_NULL_BEFORE_AND_AFTER}) |
|
31
|
|
|
* @ApiResource(attributes={"order"={"badge.type", "badge.value"}}) |
|
32
|
|
|
* @ApiFilter( |
|
33
|
|
|
* GroupFilter::class, |
|
34
|
|
|
* arguments={ |
|
35
|
|
|
* "parameterName": "groups", |
|
36
|
|
|
* "overrideDefaultGroups": true, |
|
37
|
|
|
* "whitelist": {"playerBadge.read","playerBadge.badge","playerBadge.player","player.read.mini", "badge.read", "badge.game"} |
|
38
|
|
|
* } |
|
39
|
|
|
* ) |
|
40
|
|
|
* @ApiFilter( |
|
41
|
|
|
* OrderFilter::class, |
|
42
|
|
|
* properties={ |
|
43
|
|
|
* "id":"ASC", |
|
44
|
|
|
* "createdAt":"ASC", |
|
45
|
|
|
* "mbOrder":"ASC", |
|
46
|
|
|
* }, |
|
47
|
|
|
* arguments={"orderParameterName"="order"} |
|
48
|
|
|
* ) |
|
49
|
|
|
*/ |
|
50
|
|
|
class PlayerBadge implements BadgeInterface |
|
51
|
|
|
{ |
|
52
|
|
|
use TimestampableEntity; |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* @ORM\Column(name="id", type="integer") |
|
56
|
|
|
* @ORM\Id |
|
57
|
|
|
* @ORM\GeneratedValue(strategy="IDENTITY") |
|
58
|
|
|
*/ |
|
59
|
|
|
private ?int $id = null; |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* @ORM\Column(name="ended_at", type="datetime", nullable=true) |
|
63
|
|
|
*/ |
|
64
|
|
|
private ?DateTime $ended_at = null; |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* @ORM\Column(name="mbOrder", type="integer", nullable=true, options={"default":0}) |
|
68
|
|
|
*/ |
|
69
|
|
|
private ?int $mbOrder = null; |
|
70
|
|
|
|
|
71
|
|
|
/** |
|
72
|
|
|
* @ORM\ManyToOne(targetEntity="VideoGamesRecords\CoreBundle\Entity\Player") |
|
73
|
|
|
* @ORM\JoinColumns({ |
|
74
|
|
|
* @ORM\JoinColumn(name="idPlayer", referencedColumnName="id", nullable=false, onDelete="CASCADE") |
|
75
|
|
|
* }) |
|
76
|
|
|
*/ |
|
77
|
|
|
private Player $player; |
|
78
|
|
|
|
|
79
|
|
|
/** |
|
80
|
|
|
* @ORM\ManyToOne(targetEntity="VideoGamesRecords\CoreBundle\Entity\Badge", fetch="EAGER") |
|
81
|
|
|
* @ORM\JoinColumns({ |
|
82
|
|
|
* @ORM\JoinColumn(name="idBadge", referencedColumnName="id", nullable=false, onDelete="CASCADE") |
|
83
|
|
|
* }) |
|
84
|
|
|
*/ |
|
85
|
|
|
private Badge $badge; |
|
86
|
|
|
|
|
87
|
|
|
private string $title = ''; |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* Set id |
|
91
|
|
|
* |
|
92
|
|
|
* @param integer $id |
|
93
|
|
|
* @return $this |
|
94
|
|
|
*/ |
|
95
|
|
|
public function setId(int $id): static |
|
96
|
|
|
{ |
|
97
|
|
|
$this->id = $id; |
|
98
|
|
|
|
|
99
|
|
|
return $this; |
|
100
|
|
|
} |
|
101
|
|
|
|
|
102
|
|
|
/** |
|
103
|
|
|
* Get id |
|
104
|
|
|
* |
|
105
|
|
|
* @return integer |
|
106
|
|
|
*/ |
|
107
|
|
|
public function getId(): ?int |
|
108
|
|
|
{ |
|
109
|
|
|
return $this->id; |
|
110
|
|
|
} |
|
111
|
|
|
|
|
112
|
|
|
/** |
|
113
|
|
|
* Set ended_at |
|
114
|
|
|
* |
|
115
|
|
|
* @param DateTime $ended_at |
|
116
|
|
|
* @return $this |
|
117
|
|
|
*/ |
|
118
|
|
|
public function setEndedAt(DateTime $ended_at): static |
|
119
|
|
|
{ |
|
120
|
|
|
$this->ended_at = $ended_at; |
|
121
|
|
|
|
|
122
|
|
|
return $this; |
|
123
|
|
|
} |
|
124
|
|
|
|
|
125
|
|
|
/** |
|
126
|
|
|
* Get ended_at |
|
127
|
|
|
* |
|
128
|
|
|
* @return DateTime |
|
129
|
|
|
*/ |
|
130
|
|
|
public function getEndedAt(): ?DateTime |
|
131
|
|
|
{ |
|
132
|
|
|
return $this->ended_at; |
|
133
|
|
|
} |
|
134
|
|
|
|
|
135
|
|
|
/** |
|
136
|
|
|
* Set mbOrder |
|
137
|
|
|
* |
|
138
|
|
|
* @param integer $mbOrder |
|
139
|
|
|
* @return $this |
|
140
|
|
|
*/ |
|
141
|
|
|
public function setMbOrder(int $mbOrder): static |
|
142
|
|
|
{ |
|
143
|
|
|
$this->mbOrder = $mbOrder; |
|
144
|
|
|
|
|
145
|
|
|
return $this; |
|
146
|
|
|
} |
|
147
|
|
|
|
|
148
|
|
|
/** |
|
149
|
|
|
* Get mbOrder |
|
150
|
|
|
* |
|
151
|
|
|
* @return integer |
|
152
|
|
|
*/ |
|
153
|
|
|
public function getMbOrder(): ?int |
|
154
|
|
|
{ |
|
155
|
|
|
return $this->mbOrder; |
|
156
|
|
|
} |
|
157
|
|
|
|
|
158
|
|
|
/** |
|
159
|
|
|
* Set badge |
|
160
|
|
|
* |
|
161
|
|
|
* @param Badge $badge |
|
162
|
|
|
* @return $this |
|
163
|
|
|
*/ |
|
164
|
|
|
public function setBadge(Badge $badge): static |
|
165
|
|
|
{ |
|
166
|
|
|
$this->badge = $badge; |
|
167
|
|
|
|
|
168
|
|
|
return $this; |
|
169
|
|
|
} |
|
170
|
|
|
|
|
171
|
|
|
/** |
|
172
|
|
|
* Get badge |
|
173
|
|
|
* |
|
174
|
|
|
* @return Badge |
|
175
|
|
|
*/ |
|
176
|
|
|
public function getBadge(): Badge |
|
177
|
|
|
{ |
|
178
|
|
|
return $this->badge; |
|
179
|
|
|
} |
|
180
|
|
|
|
|
181
|
|
|
|
|
182
|
|
|
/** |
|
183
|
|
|
* Set player |
|
184
|
|
|
* @param Player $player |
|
185
|
|
|
* @return $this |
|
186
|
|
|
*/ |
|
187
|
|
|
public function setPlayer(Player $player): static |
|
188
|
|
|
{ |
|
189
|
|
|
$this->player = $player; |
|
190
|
|
|
|
|
191
|
|
|
return $this; |
|
192
|
|
|
} |
|
193
|
|
|
|
|
194
|
|
|
/** |
|
195
|
|
|
* Get player |
|
196
|
|
|
* |
|
197
|
|
|
* @return Player |
|
198
|
|
|
*/ |
|
199
|
|
|
public function getPlayer(): Player |
|
200
|
|
|
{ |
|
201
|
|
|
return $this->player; |
|
202
|
|
|
} |
|
203
|
|
|
|
|
204
|
|
|
public function setTitle(string $title): static |
|
205
|
|
|
{ |
|
206
|
|
|
$this->title = $title; |
|
207
|
|
|
return $this; |
|
208
|
|
|
} |
|
209
|
|
|
|
|
210
|
|
|
/** |
|
211
|
|
|
* @return string |
|
212
|
|
|
*/ |
|
213
|
|
|
public function getTitle(): string |
|
214
|
|
|
{ |
|
215
|
|
|
return $this->title; |
|
216
|
|
|
} |
|
217
|
|
|
|
|
218
|
|
|
public function __toString(): string |
|
219
|
|
|
{ |
|
220
|
|
|
return sprintf('%s # %s ', $this->getPlayer()->getPseudo(), $this->getBadge()->__toString()); |
|
221
|
|
|
} |
|
222
|
|
|
} |
|
223
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths