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