1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Loevgaard\DandomainFoundation\Entity; |
4
|
|
|
|
5
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
6
|
|
|
use Doctrine\ORM\Mapping as ORM; |
7
|
|
|
use Knp\DoctrineBehaviors\Model\Translatable\Translatable; |
8
|
|
|
use Loevgaard\DandomainFoundation\Entity\Generated\TagInterface; |
|
|
|
|
9
|
|
|
use Loevgaard\DandomainFoundation\Entity\Generated\TagTrait; |
|
|
|
|
10
|
|
|
use Loevgaard\DandomainFoundation\Entity\Generated\TagTranslationInterface; |
|
|
|
|
11
|
|
|
use Loevgaard\DandomainFoundation\Entity\Generated\TagValueInterface; |
|
|
|
|
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* @ORM\Entity() |
15
|
|
|
* @ORM\Table(name="ldf_tags") |
16
|
|
|
* |
17
|
|
|
* @method TagTranslationInterface translate(string $locale = null, bool $fallbackToDefault = true) |
18
|
|
|
*/ |
19
|
|
|
class Tag extends AbstractEntity implements TagInterface |
20
|
|
|
{ |
21
|
|
|
use TagTrait; |
22
|
|
|
use Translatable; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @var int |
26
|
|
|
* |
27
|
|
|
* @ORM\Id |
28
|
|
|
* @ORM\GeneratedValue |
29
|
|
|
* @ORM\Column(type="integer") |
30
|
|
|
**/ |
31
|
|
|
protected $id; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @var int |
35
|
|
|
* |
36
|
|
|
* @ORM\Column(type="integer", unique=true) |
37
|
|
|
**/ |
38
|
|
|
protected $externalId; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @var string|null |
42
|
|
|
* |
43
|
|
|
* @ORM\Column(type="string", nullable=true, length=191) |
44
|
|
|
**/ |
45
|
|
|
protected $selectorType; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @var int|null |
49
|
|
|
* |
50
|
|
|
* @ORM\Column(type="integer", nullable=true) |
51
|
|
|
**/ |
52
|
|
|
protected $sortOrder; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @var TagValueInterface[]|ArrayCollection |
56
|
|
|
* |
57
|
|
|
* @ORM\OneToMany(targetEntity="TagValue", mappedBy="tag", cascade={"persist", "remove"}, orphanRemoval=true) |
58
|
|
|
*/ |
59
|
|
|
protected $tagValues; |
60
|
|
|
|
61
|
|
|
public function __construct() |
62
|
|
|
{ |
63
|
|
|
$this->tagValues = new ArrayCollection(); |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
public function addTagValue(TagValueInterface $tagValue): TagInterface |
67
|
|
|
{ |
68
|
|
|
if (!$this->hasTagValue($tagValue)) { |
69
|
|
|
$this->tagValues->add($tagValue); |
70
|
|
|
$tagValue->setTag($this); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
return $this; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
public function hasTagValue($tagValue): bool |
77
|
|
|
{ |
78
|
|
|
if ($tagValue instanceof TagValueInterface) { |
79
|
|
|
$tagValue = $tagValue->getExternalId(); |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
return $this->tagValues->exists(function ($key, TagValueInterface $element) use ($tagValue) { |
83
|
|
|
return $element->getExternalId() === $tagValue; |
84
|
|
|
}); |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
public function removeTagValue(TagValueInterface $tagValue): TagInterface |
88
|
|
|
{ |
89
|
|
|
$this->tagValues->removeElement($tagValue); |
90
|
|
|
$tagValue->setTag(null); |
91
|
|
|
|
92
|
|
|
return $this; |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
public function clearTagValues(): TagInterface |
96
|
|
|
{ |
97
|
|
|
foreach ($this->tagValues as $tagValue) { |
98
|
|
|
$this->removeTagValue($tagValue); |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
return $this; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* @return int |
106
|
|
|
*/ |
107
|
|
|
public function getId(): int |
108
|
|
|
{ |
109
|
|
|
return (int) $this->id; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* @param int $id |
114
|
|
|
* |
115
|
|
|
* @return Tag |
116
|
|
|
*/ |
117
|
|
|
public function setId(int $id) |
118
|
|
|
{ |
119
|
|
|
$this->id = $id; |
120
|
|
|
|
121
|
|
|
return $this; |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* @return int |
126
|
|
|
*/ |
127
|
|
|
public function getExternalId(): int |
128
|
|
|
{ |
129
|
|
|
return (int) $this->externalId; |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* @param int $externalId |
134
|
|
|
* |
135
|
|
|
* @return Tag |
136
|
|
|
*/ |
137
|
|
|
public function setExternalId(int $externalId) |
138
|
|
|
{ |
139
|
|
|
$this->externalId = $externalId; |
140
|
|
|
|
141
|
|
|
return $this; |
142
|
|
|
} |
143
|
|
|
|
144
|
|
|
/** |
145
|
|
|
* @return null|string |
146
|
|
|
*/ |
147
|
|
|
public function getSelectorType(): ?string |
148
|
|
|
{ |
149
|
|
|
return $this->selectorType; |
150
|
|
|
} |
151
|
|
|
|
152
|
|
|
/** |
153
|
|
|
* @param null|string $selectorType |
154
|
|
|
* |
155
|
|
|
* @return Tag |
156
|
|
|
*/ |
157
|
|
|
public function setSelectorType(?string $selectorType) |
158
|
|
|
{ |
159
|
|
|
$this->selectorType = $selectorType; |
160
|
|
|
|
161
|
|
|
return $this; |
162
|
|
|
} |
163
|
|
|
|
164
|
|
|
/** |
165
|
|
|
* @return int|null |
166
|
|
|
*/ |
167
|
|
|
public function getSortOrder(): ?int |
168
|
|
|
{ |
169
|
|
|
return $this->sortOrder; |
170
|
|
|
} |
171
|
|
|
|
172
|
|
|
/** |
173
|
|
|
* @param int|null $sortOrder |
174
|
|
|
* |
175
|
|
|
* @return Tag |
176
|
|
|
*/ |
177
|
|
|
public function setSortOrder(?int $sortOrder) |
178
|
|
|
{ |
179
|
|
|
$this->sortOrder = $sortOrder; |
180
|
|
|
|
181
|
|
|
return $this; |
182
|
|
|
} |
183
|
|
|
|
184
|
|
|
/** |
185
|
|
|
* @return ArrayCollection|TagValueInterface[] |
186
|
|
|
*/ |
187
|
|
|
public function getTagValues() |
188
|
|
|
{ |
189
|
|
|
return $this->tagValues; |
190
|
|
|
} |
191
|
|
|
|
192
|
|
|
/** |
193
|
|
|
* @param ArrayCollection|TagValueInterface[] $tagValues |
194
|
|
|
* |
195
|
|
|
* @return Tag |
196
|
|
|
*/ |
197
|
|
|
public function setTagValues($tagValues) |
198
|
|
|
{ |
199
|
|
|
$this->tagValues = $tagValues; |
200
|
|
|
|
201
|
|
|
return $this; |
202
|
|
|
} |
203
|
|
|
} |
204
|
|
|
|
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