1
|
|
|
<?php |
2
|
|
|
namespace Torakel\DatabaseBundle\Entity; |
3
|
|
|
|
4
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
|
|
|
5
|
|
|
|
6
|
|
|
/** |
7
|
|
|
* @ORM\Entity |
8
|
|
|
* @ORM\HasLifecycleCallbacks |
9
|
|
|
* @ORM\Table(name="ground") |
10
|
|
|
*/ |
11
|
|
|
class Ground |
12
|
|
|
{ |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* @var integer |
16
|
|
|
* @ORM\Column(type="integer") |
17
|
|
|
* @ORM\Id |
18
|
|
|
* @ORM\GeneratedValue(strategy="AUTO") |
19
|
|
|
*/ |
20
|
|
|
private $id; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @var string |
24
|
|
|
* @ORM\Column(type="string") |
25
|
|
|
*/ |
26
|
|
|
protected $slug; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @var string |
30
|
|
|
* @ORM\Column(type="string") |
31
|
|
|
*/ |
32
|
|
|
protected $name; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @var string |
36
|
|
|
* @ORM\Column(name="alt_names", type="text", nullable=true) |
37
|
|
|
*/ |
38
|
|
|
protected $altNames; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @var \Torakel\DatabaseBundle\Entity\City |
42
|
|
|
* @ORM\ManyToOne(targetEntity="\Torakel\DatabaseBundle\Entity\City", inversedBy="grounds") |
43
|
|
|
* @ORM\JoinColumn(name="city_id", referencedColumnName="id") |
44
|
|
|
*/ |
45
|
|
|
protected $city; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @var string |
49
|
|
|
* @ORM\Column(type="string", nullable=true) |
50
|
|
|
*/ |
51
|
|
|
protected $address; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @var \Doctrine\Common\Collections\ArrayCollection; |
55
|
|
|
* @ORM\OneToMany(targetEntity="\Torakel\DatabaseBundle\Entity\Game", mappedBy="ground") |
56
|
|
|
*/ |
57
|
|
|
protected $games; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @var \DateTime |
61
|
|
|
* @ORM\Column(type="datetime", nullable=true) |
62
|
|
|
*/ |
63
|
|
|
protected $since; |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @var integer |
67
|
|
|
* @ORM\Column(type="integer", nullable=true) |
68
|
|
|
*/ |
69
|
|
|
protected $capacity; |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @var \DateTime |
73
|
|
|
* @ORM\Column(type="datetime", name="created_at") |
74
|
|
|
*/ |
75
|
|
|
protected $createdAt; |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* @var \DateTime |
79
|
|
|
* @ORM\Column(type="datetime", name="updated_at", nullable=true) |
80
|
|
|
*/ |
81
|
|
|
protected $updatedAt; |
82
|
|
|
/** |
83
|
|
|
* Constructor |
84
|
|
|
*/ |
85
|
4 |
|
public function __construct() |
86
|
|
|
{ |
87
|
4 |
|
$this->games = new \Doctrine\Common\Collections\ArrayCollection(); |
88
|
4 |
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* Get id |
92
|
|
|
* |
93
|
|
|
* @return integer |
94
|
|
|
*/ |
95
|
1 |
|
public function getId() |
96
|
|
|
{ |
97
|
1 |
|
return $this->id; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* Set slug |
102
|
|
|
* |
103
|
|
|
* @param string $slug |
104
|
|
|
* |
105
|
|
|
* @return Ground |
106
|
|
|
*/ |
107
|
1 |
|
public function setSlug($slug) |
108
|
|
|
{ |
109
|
1 |
|
$this->slug = $slug; |
110
|
|
|
|
111
|
1 |
|
return $this; |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* Get slug |
116
|
|
|
* |
117
|
|
|
* @return string |
118
|
|
|
*/ |
119
|
1 |
|
public function getSlug() |
120
|
|
|
{ |
121
|
1 |
|
return $this->slug; |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* Set name |
126
|
|
|
* |
127
|
|
|
* @param string $name |
128
|
|
|
* |
129
|
|
|
* @return Ground |
130
|
|
|
*/ |
131
|
1 |
|
public function setName($name) |
132
|
|
|
{ |
133
|
1 |
|
$this->name = $name; |
134
|
|
|
|
135
|
1 |
|
return $this; |
136
|
|
|
} |
137
|
|
|
|
138
|
|
|
/** |
139
|
|
|
* Get name |
140
|
|
|
* |
141
|
|
|
* @return string |
142
|
|
|
*/ |
143
|
1 |
|
public function getName() |
144
|
|
|
{ |
145
|
1 |
|
return $this->name; |
146
|
|
|
} |
147
|
|
|
|
148
|
|
|
/** |
149
|
|
|
* Add alt(ernative) name |
150
|
|
|
* |
151
|
|
|
* Adds an alternative name to the entity. For example external IDs. |
152
|
|
|
* |
153
|
|
|
* @param $name |
154
|
|
|
*/ |
155
|
1 |
|
public function addAltName($name) |
156
|
|
|
{ |
157
|
1 |
|
$names = $this->getAltNames(); |
158
|
1 |
|
if (in_array($name, $names) === false) { |
159
|
1 |
|
$names[] = $name; |
160
|
1 |
|
$this->setAltNames($names); |
161
|
|
|
} |
162
|
1 |
|
} |
163
|
|
|
|
164
|
|
|
/** |
165
|
|
|
* Set altNames |
166
|
|
|
* |
167
|
|
|
* @param array $altNames |
168
|
|
|
* |
169
|
|
|
* @return Player |
170
|
|
|
*/ |
171
|
1 |
|
public function setAltNames($altNames) |
172
|
|
|
{ |
173
|
1 |
|
$this->altNames = implode('|', $altNames); |
174
|
|
|
|
175
|
1 |
|
return $this; |
|
|
|
|
176
|
|
|
} |
177
|
|
|
|
178
|
|
|
/** |
179
|
|
|
* Get altNames |
180
|
|
|
* |
181
|
|
|
* @return array |
182
|
|
|
*/ |
183
|
1 |
|
public function getAltNames() |
184
|
|
|
{ |
185
|
1 |
|
return explode('|', $this->altNames); |
186
|
|
|
} |
187
|
|
|
|
188
|
|
|
/** |
189
|
|
|
* Set since |
190
|
|
|
* |
191
|
|
|
* @param \DateTime $since |
192
|
|
|
* |
193
|
|
|
* @return Ground |
194
|
|
|
*/ |
195
|
1 |
|
public function setSince($since) |
196
|
|
|
{ |
197
|
1 |
|
$this->since = $since; |
198
|
|
|
|
199
|
1 |
|
return $this; |
200
|
|
|
} |
201
|
|
|
|
202
|
|
|
/** |
203
|
|
|
* Get since |
204
|
|
|
* |
205
|
|
|
* @return \DateTime |
206
|
|
|
*/ |
207
|
1 |
|
public function getSince() |
208
|
|
|
{ |
209
|
1 |
|
return $this->since; |
210
|
|
|
} |
211
|
|
|
|
212
|
|
|
/** |
213
|
|
|
* Set capacity |
214
|
|
|
* |
215
|
|
|
* @param integer $capacity |
216
|
|
|
* |
217
|
|
|
* @return Ground |
218
|
|
|
*/ |
219
|
1 |
|
public function setCapacity($capacity) |
220
|
|
|
{ |
221
|
1 |
|
$this->capacity = $capacity; |
222
|
|
|
|
223
|
1 |
|
return $this; |
224
|
|
|
} |
225
|
|
|
|
226
|
|
|
/** |
227
|
|
|
* Get capacity |
228
|
|
|
* |
229
|
|
|
* @return integer |
230
|
|
|
*/ |
231
|
1 |
|
public function getCapacity() |
232
|
|
|
{ |
233
|
1 |
|
return $this->capacity; |
234
|
|
|
} |
235
|
|
|
|
236
|
|
|
/** |
237
|
|
|
* Set createdAt |
238
|
|
|
* |
239
|
|
|
* @param \DateTime $createdAt |
240
|
|
|
* |
241
|
|
|
* @return Ground |
242
|
|
|
*/ |
243
|
1 |
|
public function setCreatedAt($createdAt) |
244
|
|
|
{ |
245
|
1 |
|
$this->createdAt = $createdAt; |
246
|
|
|
|
247
|
1 |
|
return $this; |
248
|
|
|
} |
249
|
|
|
|
250
|
|
|
/** |
251
|
|
|
* Get createdAt |
252
|
|
|
* |
253
|
|
|
* @return \DateTime |
254
|
|
|
*/ |
255
|
1 |
|
public function getCreatedAt() |
256
|
|
|
{ |
257
|
1 |
|
return $this->createdAt; |
258
|
|
|
} |
259
|
|
|
|
260
|
|
|
/** |
261
|
|
|
* Set updatedAt |
262
|
|
|
* |
263
|
|
|
* @param \DateTime $updatedAt |
264
|
|
|
* |
265
|
|
|
* @return Ground |
266
|
|
|
*/ |
267
|
1 |
|
public function setUpdatedAt($updatedAt) |
268
|
|
|
{ |
269
|
1 |
|
$this->updatedAt = $updatedAt; |
270
|
|
|
|
271
|
1 |
|
return $this; |
272
|
|
|
} |
273
|
|
|
|
274
|
|
|
/** |
275
|
|
|
* Get updatedAt |
276
|
|
|
* |
277
|
|
|
* @return \DateTime |
278
|
|
|
*/ |
279
|
1 |
|
public function getUpdatedAt() |
280
|
|
|
{ |
281
|
1 |
|
return $this->updatedAt; |
282
|
|
|
} |
283
|
|
|
|
284
|
|
|
/** |
285
|
|
|
* Set city |
286
|
|
|
* |
287
|
|
|
* @param \Torakel\DatabaseBundle\Entity\City $city |
288
|
|
|
* |
289
|
|
|
* @return Ground |
290
|
|
|
*/ |
291
|
1 |
|
public function setCity(\Torakel\DatabaseBundle\Entity\City $city = null) |
292
|
|
|
{ |
293
|
1 |
|
$this->city = $city; |
294
|
|
|
|
295
|
1 |
|
return $this; |
296
|
|
|
} |
297
|
|
|
|
298
|
|
|
/** |
299
|
|
|
* Get city |
300
|
|
|
* |
301
|
|
|
* @return \Torakel\DatabaseBundle\Entity\City |
302
|
|
|
*/ |
303
|
1 |
|
public function getCity() |
304
|
|
|
{ |
305
|
1 |
|
return $this->city; |
306
|
|
|
} |
307
|
|
|
|
308
|
|
|
/** |
309
|
|
|
* Add game |
310
|
|
|
* |
311
|
|
|
* @param \Torakel\DatabaseBundle\Entity\Game $game |
312
|
|
|
* |
313
|
|
|
* @return Ground |
314
|
|
|
*/ |
315
|
1 |
|
public function addGame(\Torakel\DatabaseBundle\Entity\Game $game) |
316
|
|
|
{ |
317
|
1 |
|
$this->games[] = $game; |
318
|
|
|
|
319
|
1 |
|
return $this; |
320
|
|
|
} |
321
|
|
|
|
322
|
|
|
/** |
323
|
|
|
* Remove game |
324
|
|
|
* |
325
|
|
|
* @param \Torakel\DatabaseBundle\Entity\Game $game |
326
|
|
|
*/ |
327
|
1 |
|
public function removeGame(\Torakel\DatabaseBundle\Entity\Game $game) |
328
|
|
|
{ |
329
|
1 |
|
$this->games->removeElement($game); |
330
|
1 |
|
} |
331
|
|
|
|
332
|
|
|
/** |
333
|
|
|
* Get games |
334
|
|
|
* |
335
|
|
|
* @return \Doctrine\Common\Collections\Collection |
336
|
|
|
*/ |
337
|
1 |
|
public function getGames() |
338
|
|
|
{ |
339
|
1 |
|
return $this->games; |
340
|
|
|
} |
341
|
|
|
|
342
|
|
|
/** |
343
|
|
|
* @ORM\PrePersist |
344
|
|
|
*/ |
345
|
1 |
|
public function prePersist() |
346
|
|
|
{ |
347
|
1 |
|
$this->createdAt = new \DateTime(); |
348
|
1 |
|
$altNames = $this->getAltNames(); |
349
|
1 |
|
$altNames[999999] = ''; |
350
|
1 |
|
$this->setAltNames($altNames); |
351
|
1 |
|
} |
352
|
|
|
|
353
|
|
|
/** |
354
|
|
|
* @ORM\PreUpdate |
355
|
|
|
*/ |
356
|
1 |
|
public function preUpdate() |
357
|
|
|
{ |
358
|
1 |
|
$this->updatedAt = new \DateTime(); |
359
|
1 |
|
} |
360
|
|
|
|
361
|
|
|
/** |
362
|
|
|
* Set address |
363
|
|
|
* |
364
|
|
|
* @param string $address |
365
|
|
|
* |
366
|
|
|
* @return Ground |
367
|
|
|
*/ |
368
|
1 |
|
public function setAddress($address) |
369
|
|
|
{ |
370
|
1 |
|
$this->address = $address; |
371
|
|
|
|
372
|
1 |
|
return $this; |
373
|
|
|
} |
374
|
|
|
|
375
|
|
|
/** |
376
|
|
|
* Get address |
377
|
|
|
* |
378
|
|
|
* @return string |
379
|
|
|
*/ |
380
|
1 |
|
public function getAddress() |
381
|
|
|
{ |
382
|
1 |
|
return $this->address; |
383
|
|
|
} |
384
|
|
|
} |
385
|
|
|
|
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