1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Entity; |
4
|
|
|
|
5
|
|
|
use App\Entity\Attribute\Accessor as ServiceAccessor; |
6
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
|
|
|
|
7
|
|
|
use Ds\Component\Locale\Model\Type\Localizable; |
|
|
|
|
8
|
|
|
use Ds\Component\Model\Attribute\Accessor; |
|
|
|
|
9
|
|
|
use Ds\Component\Model\Type\Deletable; |
|
|
|
|
10
|
|
|
use Ds\Component\Model\Type\Enableable; |
|
|
|
|
11
|
|
|
use Ds\Component\Model\Type\Identifiable; |
|
|
|
|
12
|
|
|
use Ds\Component\Model\Type\Ownable; |
|
|
|
|
13
|
|
|
use Ds\Component\Model\Type\Sluggable; |
|
|
|
|
14
|
|
|
use Ds\Component\Model\Type\Uuidentifiable; |
|
|
|
|
15
|
|
|
use Ds\Component\Model\Type\Versionable; |
|
|
|
|
16
|
|
|
use Ds\Component\Tenant\Model\Attribute\Accessor as TenantAccessor; |
|
|
|
|
17
|
|
|
use Ds\Component\Tenant\Model\Type\Tenantable; |
|
|
|
|
18
|
|
|
use Ds\Component\Translation\Model\Attribute\Accessor as TranslationAccessor; |
|
|
|
|
19
|
|
|
use Ds\Component\Translation\Model\Type\Translatable; |
|
|
|
|
20
|
|
|
use Knp\DoctrineBehaviors\Model as Behavior; |
|
|
|
|
21
|
|
|
|
22
|
|
|
use ApiPlatform\Core\Annotation\ApiResource; |
|
|
|
|
23
|
|
|
use ApiPlatform\Core\Annotation\ApiProperty; |
|
|
|
|
24
|
|
|
use App\Validator\Constraints\Scenario as ScenarioAssert; |
25
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
|
|
|
26
|
|
|
use Ds\Component\Locale\Model\Annotation\Locale; |
|
|
|
|
27
|
|
|
use Ds\Component\Translation\Model\Annotation\Translate; |
|
|
|
|
28
|
|
|
use Symfony\Bridge\Doctrine\Validator\Constraints as ORMAssert; |
|
|
|
|
29
|
|
|
use Symfony\Component\Serializer\Annotation as Serializer; |
|
|
|
|
30
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
|
|
|
|
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Class Scenario |
34
|
|
|
* |
35
|
|
|
* @ApiResource( |
36
|
|
|
* attributes={ |
37
|
|
|
* "normalization_context"={ |
38
|
|
|
* "groups"={"scenario_output"} |
39
|
|
|
* }, |
40
|
|
|
* "denormalization_context"={ |
41
|
|
|
* "groups"={"scenario_input"} |
42
|
|
|
* }, |
43
|
|
|
* "filters"={ |
44
|
|
|
* "app.scenario.search", |
45
|
|
|
* "app.scenario.search_translation", |
46
|
|
|
* "app.scenario.date", |
47
|
|
|
* "app.scenario.boolean", |
48
|
|
|
* "app.scenario.order", |
49
|
|
|
* "app.scenario.order_translation" |
50
|
|
|
* } |
51
|
|
|
* } |
52
|
|
|
* ) |
53
|
|
|
* @ORM\Entity(repositoryClass="App\Repository\ScenarioRepository") |
54
|
|
|
* @ORM\Table( |
55
|
|
|
* name="app_scenario", |
56
|
|
|
* uniqueConstraints={ |
57
|
|
|
* @ORM\UniqueConstraint(columns={"service_id", "slug"}) |
58
|
|
|
* } |
59
|
|
|
* ) |
60
|
|
|
* @ORM\Cache(usage="NONSTRICT_READ_WRITE") |
61
|
|
|
* @ORMAssert\UniqueEntity(fields="uuid") |
62
|
|
|
* @ORMAssert\UniqueEntity(fields={"service", "slug"}) |
63
|
|
|
* @ScenarioAssert\Config\Valid |
64
|
|
|
*/ |
65
|
|
|
class Scenario implements Identifiable, Uuidentifiable, Sluggable, Ownable, Translatable, Localizable, Enableable, Deletable, Versionable, Tenantable |
66
|
|
|
{ |
67
|
|
|
use Behavior\Translatable\Translatable; |
|
|
|
|
68
|
|
|
use Behavior\Timestampable\Timestampable; |
|
|
|
|
69
|
|
|
use Behavior\SoftDeletable\SoftDeletable; |
|
|
|
|
70
|
|
|
|
71
|
|
|
use Accessor\Id; |
|
|
|
|
72
|
|
|
use Accessor\Uuid; |
|
|
|
|
73
|
|
|
use Accessor\Owner; |
|
|
|
|
74
|
|
|
use Accessor\OwnerUuid; |
|
|
|
|
75
|
|
|
use ServiceAccessor\Service; |
76
|
|
|
use Accessor\Type; |
|
|
|
|
77
|
|
|
use Accessor\Config; |
|
|
|
|
78
|
|
|
use Accessor\Slug; |
|
|
|
|
79
|
|
|
use TranslationAccessor\Title; |
|
|
|
|
80
|
|
|
use TranslationAccessor\Description; |
|
|
|
|
81
|
|
|
use TranslationAccessor\Presentation; |
|
|
|
|
82
|
|
|
use TranslationAccessor\Data; |
|
|
|
|
83
|
|
|
use ServiceAccessor\Submissions; |
84
|
|
|
use Accessor\Enabled; |
|
|
|
|
85
|
|
|
use Accessor\Deleted; |
|
|
|
|
86
|
|
|
use Accessor\Weight; |
|
|
|
|
87
|
|
|
use Accessor\Version; |
|
|
|
|
88
|
|
|
use TenantAccessor\Tenant; |
|
|
|
|
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @const string |
92
|
|
|
*/ |
93
|
|
|
const TYPE_API = 'api'; |
94
|
|
|
const TYPE_BPM = 'bpm'; |
95
|
|
|
const TYPE_INFO = 'info'; |
96
|
|
|
const TYPE_URL = 'url'; |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* @var integer |
100
|
|
|
* @ApiProperty(identifier=false, writable=false) |
101
|
|
|
* @Serializer\Groups({"scenario_output"}) |
102
|
|
|
* @ORM\Id |
103
|
|
|
* @ORM\GeneratedValue(strategy="AUTO") |
104
|
|
|
* @ORM\Column(name="id", type="integer") |
105
|
|
|
*/ |
106
|
|
|
private $id; |
|
|
|
|
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* @var string |
110
|
|
|
* @ApiProperty(identifier=true, writable=false) |
111
|
|
|
* @Serializer\Groups({"scenario_output"}) |
112
|
|
|
* @ORM\Column(name="uuid", type="guid", unique=true) |
113
|
|
|
* @Assert\Uuid |
114
|
|
|
*/ |
115
|
|
|
private $uuid; |
|
|
|
|
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* @var \DateTime |
119
|
|
|
* @ApiProperty(writable=false) |
120
|
|
|
* @Serializer\Groups({"scenario_output"}) |
121
|
|
|
*/ |
122
|
|
|
protected $createdAt; |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* @var \DateTime |
126
|
|
|
* @ApiProperty(writable=false) |
127
|
|
|
* @Serializer\Groups({"scenario_output"}) |
128
|
|
|
*/ |
129
|
|
|
protected $updatedAt; |
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* @var \DateTime |
133
|
|
|
* @ApiProperty(writable=false) |
134
|
|
|
* @Serializer\Groups({"scenario_output"}) |
135
|
|
|
*/ |
136
|
|
|
protected $deletedAt; |
137
|
|
|
|
138
|
|
|
/** |
139
|
|
|
* @var string |
140
|
|
|
* @ApiProperty |
141
|
|
|
* @Serializer\Groups({"scenario_output", "scenario_input"}) |
142
|
|
|
* @ORM\Column(name="`owner`", type="string", length=255, nullable=true) |
143
|
|
|
* @Assert\NotBlank |
144
|
|
|
* @Assert\Length(min=1, max=255) |
145
|
|
|
*/ |
146
|
|
|
private $owner; |
|
|
|
|
147
|
|
|
|
148
|
|
|
/** |
149
|
|
|
* @var string |
150
|
|
|
* @ApiProperty |
151
|
|
|
* @Serializer\Groups({"scenario_output", "scenario_input"}) |
152
|
|
|
* @ORM\Column(name="owner_uuid", type="guid", nullable=true) |
153
|
|
|
* @Assert\NotBlank |
154
|
|
|
* @Assert\Uuid |
155
|
|
|
*/ |
156
|
|
|
private $ownerUuid; |
|
|
|
|
157
|
|
|
|
158
|
|
|
/** |
159
|
|
|
* @var \App\Entity\Service |
160
|
|
|
* @Serializer\Groups({"scenario_output", "scenario_input"}) |
161
|
|
|
* @ORM\ManyToOne(targetEntity="Service", inversedBy="scenarios") |
162
|
|
|
* @ORM\JoinColumn(name="service_id", referencedColumnName="id") |
163
|
|
|
* @ORM\Cache(usage="NONSTRICT_READ_WRITE") |
164
|
|
|
* @Assert\Valid |
165
|
|
|
*/ |
166
|
|
|
private $service; |
|
|
|
|
167
|
|
|
|
168
|
|
|
/** |
169
|
|
|
* @var string |
170
|
|
|
* @ApiProperty |
171
|
|
|
* @Serializer\Groups({"scenario_output", "scenario_input"}) |
172
|
|
|
* @ORM\Column(name="`type`", type="string", length=255) |
173
|
|
|
* @Assert\NotBlank |
174
|
|
|
* @Assert\Length(min=1, max=255) |
175
|
|
|
*/ |
176
|
|
|
private $type; |
|
|
|
|
177
|
|
|
|
178
|
|
|
/** |
179
|
|
|
* @var array |
180
|
|
|
* @ApiProperty |
181
|
|
|
* @Serializer\Groups({"scenario_output", "scenario_input"}) |
182
|
|
|
* @ORM\Column(name="config", type="json_array") |
183
|
|
|
* @Assert\Type("array") |
184
|
|
|
*/ |
185
|
|
|
private $config; |
186
|
|
|
|
187
|
|
|
/** |
188
|
|
|
* @var string |
189
|
|
|
* @ApiProperty |
190
|
|
|
* @Serializer\Groups({"scenario_output", "scenario_input"}) |
191
|
|
|
* @ORM\Column(name="slug", type="string") |
192
|
|
|
* @Assert\NotBlank |
193
|
|
|
* @Assert\Length(min=1, max=255) |
194
|
|
|
*/ |
195
|
|
|
private $slug; |
|
|
|
|
196
|
|
|
|
197
|
|
|
/** |
198
|
|
|
* @var array |
199
|
|
|
* @ApiProperty |
200
|
|
|
* @Serializer\Groups({"scenario_output", "scenario_input"}) |
201
|
|
|
* @Assert\Type("array") |
202
|
|
|
* @Assert\NotBlank |
203
|
|
|
* @Assert\All({ |
204
|
|
|
* @Assert\NotBlank, |
205
|
|
|
* @Assert\Length(min=1) |
206
|
|
|
* }) |
207
|
|
|
* @Locale |
208
|
|
|
* @Translate |
209
|
|
|
*/ |
210
|
|
|
private $title; |
211
|
|
|
|
212
|
|
|
/** |
213
|
|
|
* @var array |
214
|
|
|
* @ApiProperty |
215
|
|
|
* @Serializer\Groups({"scenario_output", "scenario_input"}) |
216
|
|
|
* @Assert\Type("array") |
217
|
|
|
* @Assert\NotBlank |
218
|
|
|
* @Assert\All({ |
219
|
|
|
* @Assert\NotBlank, |
220
|
|
|
* @Assert\Length(min=1) |
221
|
|
|
* }) |
222
|
|
|
* @Locale |
223
|
|
|
* @Translate |
224
|
|
|
*/ |
225
|
|
|
private $description; |
226
|
|
|
|
227
|
|
|
/** |
228
|
|
|
* @var array |
229
|
|
|
* @ApiProperty |
230
|
|
|
* @Serializer\Groups({"scenario_output", "scenario_input"}) |
231
|
|
|
* @Assert\Type("array") |
232
|
|
|
* @Assert\NotBlank |
233
|
|
|
* @Assert\All({ |
234
|
|
|
* @Assert\NotBlank, |
235
|
|
|
* @Assert\Length(min=1) |
236
|
|
|
* }) |
237
|
|
|
* @Locale |
238
|
|
|
* @Translate |
239
|
|
|
*/ |
240
|
|
|
private $presentation; |
241
|
|
|
|
242
|
|
|
/** |
243
|
|
|
* @var array |
244
|
|
|
* @ApiProperty |
245
|
|
|
* @Serializer\Groups({"scenario_output", "scenario_input"}) |
246
|
|
|
* @Assert\Type("array") |
247
|
|
|
* @Assert\NotBlank |
248
|
|
|
* @Locale |
249
|
|
|
* @Translate |
250
|
|
|
*/ |
251
|
|
|
private $data; |
252
|
|
|
|
253
|
|
|
/** |
254
|
|
|
* @var \Doctrine\Common\Collections\ArrayCollection |
255
|
|
|
* @ORM\OneToMany(targetEntity="Submission", mappedBy="scenario") |
256
|
|
|
* @ORM\Cache(usage="NONSTRICT_READ_WRITE") |
257
|
|
|
*/ |
258
|
|
|
private $submissions; |
259
|
|
|
|
260
|
|
|
/** |
261
|
|
|
* @var string |
262
|
|
|
* @ApiProperty |
263
|
|
|
* @Serializer\Groups({"scenario_output", "scenario_input"}) |
264
|
|
|
* @ORM\Column(name="enabled", type="boolean") |
265
|
|
|
* @Assert\Type("boolean") |
266
|
|
|
*/ |
267
|
|
|
private $enabled; |
268
|
|
|
|
269
|
|
|
/** |
270
|
|
|
* @var integer |
271
|
|
|
* @ApiProperty |
272
|
|
|
* @Serializer\Groups({"scenario_output", "scenario_input"}) |
273
|
|
|
* @ORM\Column(name="weight", type="smallint") |
274
|
|
|
* @Assert\Length(min=0, max=255) |
275
|
|
|
*/ |
276
|
|
|
private $weight; |
277
|
|
|
|
278
|
|
|
/** |
279
|
|
|
* @var integer |
280
|
|
|
* @ApiProperty |
281
|
|
|
* @Serializer\Groups({"scenario_output", "scenario_input"}) |
282
|
|
|
* @ORM\Column(name="version", type="integer") |
283
|
|
|
* @ORM\Version |
284
|
|
|
* @Assert\NotBlank |
285
|
|
|
* @Assert\Type("integer") |
286
|
|
|
*/ |
287
|
|
|
private $version; |
|
|
|
|
288
|
|
|
|
289
|
|
|
/** |
290
|
|
|
* @var string |
291
|
|
|
* @ApiProperty(writable=false) |
292
|
|
|
* @Serializer\Groups({"scenario_output"}) |
293
|
|
|
* @ORM\Column(name="tenant", type="guid") |
294
|
|
|
* @Assert\Uuid |
295
|
|
|
*/ |
296
|
|
|
private $tenant; |
|
|
|
|
297
|
|
|
|
298
|
|
|
/** |
299
|
|
|
* Constructor |
300
|
|
|
*/ |
301
|
|
|
public function __construct() |
302
|
|
|
{ |
303
|
|
|
$this->config = []; |
304
|
|
|
$this->title = []; |
305
|
|
|
$this->description = []; |
306
|
|
|
$this->presentation = []; |
307
|
|
|
$this->data = []; |
308
|
|
|
$this->submissions = new ArrayCollection; |
309
|
|
|
$this->enabled = false; |
|
|
|
|
310
|
|
|
$this->weight = 0; |
311
|
|
|
} |
312
|
|
|
} |
313
|
|
|
|
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