1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Loevgaard\DandomainFoundation\Entity; |
4
|
|
|
|
5
|
|
|
use Assert\Assert; |
6
|
|
|
use Doctrine\ORM\Mapping as ORM; |
7
|
|
|
use Knp\DoctrineBehaviors\Model\SoftDeletable\SoftDeletable; |
8
|
|
|
use Loevgaard\DandomainFoundation\Entity\Generated\CurrencyInterface; |
|
|
|
|
9
|
|
|
use Loevgaard\DandomainFoundation\Entity\Generated\SiteInterface; |
|
|
|
|
10
|
|
|
use Loevgaard\DandomainFoundation\Entity\Generated\SiteTrait; |
|
|
|
|
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* @ORM\Entity() |
14
|
|
|
* @ORM\Table(name="ldf_sites") |
15
|
|
|
*/ |
16
|
|
|
class Site extends AbstractEntity implements SiteInterface |
17
|
|
|
{ |
18
|
|
|
use SiteTrait; |
19
|
|
|
use SoftDeletable; |
20
|
|
|
|
21
|
|
|
protected $hydrateConversions = [ |
22
|
|
|
'id' => 'externalId', |
23
|
|
|
]; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* @var int |
27
|
|
|
* |
28
|
|
|
* @ORM\Id |
29
|
|
|
* @ORM\GeneratedValue |
30
|
|
|
* @ORM\Column(type="integer") |
31
|
|
|
**/ |
32
|
|
|
protected $id; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @var int |
36
|
|
|
* |
37
|
|
|
* @ORM\Column(type="integer", unique=true) |
38
|
|
|
*/ |
39
|
|
|
protected $externalId; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @var int|null |
43
|
|
|
* |
44
|
|
|
* @ORM\Column(nullable=true, type="integer") |
45
|
|
|
*/ |
46
|
|
|
protected $countryId; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* The currency code in the Dandomain API refers in fact to the currencies' field named 'id' or 'code' |
50
|
|
|
* Therefore we don't have a currencyCode property, but a currency property. |
51
|
|
|
* |
52
|
|
|
* @var CurrencyInterface|null |
53
|
|
|
* |
54
|
|
|
* @ORM\ManyToOne(targetEntity="Currency") |
55
|
|
|
* @ORM\JoinColumn(nullable=false) |
56
|
|
|
*/ |
57
|
|
|
protected $currency; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @var string|null |
61
|
6 |
|
* |
62
|
|
|
* @ORM\Column(nullable=true, type="string", length=191) |
63
|
6 |
|
*/ |
64
|
|
|
protected $name; |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @ORM\PrePersist() |
68
|
|
|
* @ORM\PreUpdate() |
69
|
|
|
*/ |
70
|
3 |
|
public function validate() |
71
|
|
|
{ |
72
|
3 |
|
Assert::that($this->externalId)->integer(); |
73
|
3 |
|
Assert::thatNullOr($this->countryId)->integer(); |
74
|
|
|
Assert::that($this->currency)->isInstanceOf(CurrencyInterface::class); |
75
|
|
|
Assert::thatNullOr($this->name)->string(); |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
6 |
|
* @return int |
80
|
|
|
*/ |
81
|
6 |
|
public function getId(): int |
82
|
|
|
{ |
83
|
|
|
return (int) $this->id; |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* @param int $id |
88
|
3 |
|
* |
89
|
|
|
* @return SiteInterface |
90
|
3 |
|
*/ |
91
|
3 |
|
public function setId($id) |
92
|
|
|
{ |
93
|
|
|
$this->id = $id; |
94
|
|
|
|
95
|
|
|
return $this; |
96
|
|
|
} |
97
|
3 |
|
|
98
|
|
|
/** |
99
|
3 |
|
* @return int |
100
|
|
|
*/ |
101
|
|
|
public function getExternalId(): int |
102
|
|
|
{ |
103
|
|
|
return (int) $this->externalId; |
104
|
|
|
} |
105
|
|
|
|
106
|
3 |
|
/** |
107
|
|
|
* @param int $externalId |
108
|
3 |
|
* |
109
|
3 |
|
* @return SiteInterface |
110
|
|
|
*/ |
111
|
|
|
public function setExternalId($externalId) |
112
|
|
|
{ |
113
|
|
|
$this->externalId = $externalId; |
114
|
|
|
|
115
|
3 |
|
return $this; |
116
|
|
|
} |
117
|
3 |
|
|
118
|
|
|
/** |
119
|
|
|
* @return int|null |
120
|
|
|
*/ |
121
|
|
|
public function getCountryId() |
122
|
|
|
{ |
123
|
|
|
return $this->countryId; |
124
|
3 |
|
} |
125
|
|
|
|
126
|
3 |
|
/** |
127
|
3 |
|
* @param int|null $countryId |
128
|
|
|
* |
129
|
|
|
* @return SiteInterface |
130
|
|
|
*/ |
131
|
|
|
public function setCountryId($countryId) |
132
|
|
|
{ |
133
|
3 |
|
$this->countryId = $countryId; |
134
|
|
|
|
135
|
3 |
|
return $this; |
136
|
|
|
} |
137
|
|
|
|
138
|
|
|
/** |
139
|
|
|
* @return CurrencyInterface|null |
140
|
|
|
*/ |
141
|
|
|
public function getCurrency(): ?CurrencyInterface |
142
|
3 |
|
{ |
143
|
|
|
return $this->currency; |
144
|
3 |
|
} |
145
|
3 |
|
|
146
|
|
|
/** |
147
|
|
|
* @param CurrencyInterface|null $currency |
148
|
|
|
* |
149
|
|
|
* @return Site |
150
|
|
|
*/ |
151
|
|
|
public function setCurrency(?CurrencyInterface $currency) |
152
|
|
|
{ |
153
|
|
|
$this->currency = $currency; |
154
|
|
|
|
155
|
|
|
return $this; |
156
|
|
|
} |
157
|
|
|
|
158
|
|
|
/** |
159
|
|
|
* @return null|string |
160
|
|
|
*/ |
161
|
|
|
public function getName() |
162
|
|
|
{ |
163
|
|
|
return $this->name; |
164
|
|
|
} |
165
|
|
|
|
166
|
|
|
/** |
167
|
|
|
* @param null|string $name |
168
|
|
|
* |
169
|
|
|
* @return SiteInterface |
170
|
|
|
*/ |
171
|
|
|
public function setName($name) |
172
|
|
|
{ |
173
|
|
|
$this->name = $name; |
174
|
|
|
|
175
|
|
|
return $this; |
176
|
|
|
} |
177
|
|
|
} |
178
|
|
|
|
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