Passed
Push — master ( 21cacf...3e2820 )
by Luiz Kim
02:12
created

Task::getClient()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 2
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace ControleOnline\Entity;
4
5
use ApiPlatform\Metadata\GetCollection;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Metadata\GetCollection was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use ApiPlatform\Metadata\Post;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Metadata\Post was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use ApiPlatform\Metadata\Delete;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Metadata\Delete was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use ApiPlatform\Metadata\Patch;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Metadata\Patch was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use ApiPlatform\Metadata\Put;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Metadata\Put was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
use ApiPlatform\Metadata\Get;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Metadata\Get was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use ApiPlatform\Metadata\ApiResource;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Metadata\ApiResource was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
use ApiPlatform\Metadata\ApiProperty;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Metadata\ApiProperty was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
13
use ApiPlatform\Doctrine\Orm\Filter\OrderFilter;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Doctrine\Orm\Filter\OrderFilter was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
14
use ApiPlatform\Metadata\ApiFilter;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Metadata\ApiFilter was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
15
use Doctrine\ORM\Mapping as ORM;
0 ignored issues
show
Bug introduced by
The type Doctrine\ORM\Mapping was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
16
use Symfony\Component\Serializer\Annotation\Groups;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Serializer\Annotation\Groups was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
17
use Doctrine\Common\Collections\ArrayCollection;
0 ignored issues
show
Bug introduced by
The type Doctrine\Common\Collections\ArrayCollection was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
18
use Doctrine\Common\Collections\Collection;
0 ignored issues
show
Bug introduced by
The type Doctrine\Common\Collections\Collection was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
19
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Doctrine\Orm\Filter\SearchFilter was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
20
21
/**
22
 * Task
23
 *
24
 * @ORM\EntityListeners ({App\Listener\LogListener::class})
25
 * @ORM\Table (name="tasks")
26
 * @ORM\Entity ()
27
 */
28
#[ApiResource(
29
    operations: [
30
        new Get(
31
            security: 'is_granted(\'ROLE_CLIENT\')',
32
        ),
33
        new Put(
34
            security: 'is_granted(\'ROLE_CLIENT\')',
35
        ),
36
        new Patch(
37
            security: 'is_granted(\'ROLE_CLIENT\')',
38
        ), 
39
        new Delete(
40
            security: 'is_granted(\'ROLE_CLIENT\')',
41
        ),
42
        new Post(
43
            security: 'is_granted(\'ROLE_CLIENT\')',
44
        ),
45
        new GetCollection(
46
            security: 'is_granted(\'ROLE_CLIENT\')',
47
            uriTemplate: '/tasks',
48
        )
49
    ],
50
    formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']],
51
    security: 'is_granted(\'ROLE_CLIENT\')',
52
53
    normalizationContext: ['groups' => ['task_read']],
54
    denormalizationContext: ['groups' => ['task_write']]
55
)]
56
#[ApiFilter(filterClass: OrderFilter::class, properties: ['dueDate' => 'ASC', 'alterDate' => 'DESC'])]
57
#[ApiFilter(filterClass: SearchFilter::class, properties: [
58
    'provider' => 'exact',
59
    'taskFor' => 'exact',
60
    'registeredBy' => 'exact',
61
    'taskStatus' => 'exact',
62
    'reason' => 'exact',
63
    'criticality' => 'exact',
64
    'category' => 'exact',
65
    'client' => 'exact',
66
    'order' => 'exact',
67
    'task_type' => 'exact',
68
])]
69
70
71
class Task
72
{
73
    /**
74
     *
75
     * @ORM\Column(type="integer", nullable=false)
76
     * @ORM\Id
77
     * @ORM\GeneratedValue(strategy="IDENTITY")
78
     * @Groups({"task_read","order_read"})
79
     */
80
    private $id;
81
    /**
82
     *
83
     * @ORM\Column(name="name", type="string", length=50, nullable=false)
84
     * @Groups({"task_read","order_read"})
85
     */
86
    private $name;
87
    /**
88
     *
89
     * @ORM\Column(name="task_type", type="string", length=50, nullable=false)
90
     * @Groups({"task_read","order_read"})
91
     */
92
    private $type;
93
    /**
94
     * @var \DateTimeInterface
95
     * @ORM\Column(name="due_date", type="datetime",  nullable=true, columnDefinition="DATETIME")
96
     * @Groups({"task_read","order_read"})
97
     */
98
    private $dueDate;
99
    /**
100
     * @var \ControleOnline\Entity\People
0 ignored issues
show
Bug introduced by
The type ControleOnline\Entity\People was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
101
     *
102
     * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\People")
103
     * @ORM\JoinColumns({
104
     *   @ORM\JoinColumn(name="registered_by_id", referencedColumnName="id", nullable=true)
105
     * })
106
     * @Groups({"task_read","order_read"})
107
     */
108
    private $registeredBy;
109
    /**
110
     * @var \ControleOnline\Entity\People
111
     *
112
     * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\People")
113
     * @ORM\JoinColumns({
114
     *   @ORM\JoinColumn(name="task_for_id", referencedColumnName="id", nullable=false)
115
     * })
116
     * @Groups({"task_read","order_read"})
117
     */
118
    private $taskFor;
119
    /**
120
     * @var \ControleOnline\Entity\People
121
     *
122
     * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\People")
123
     * @ORM\JoinColumns({
124
     *   @ORM\JoinColumn(name="client_id", referencedColumnName="id", nullable=false)
125
     * })
126
     * @Groups({"task_read","order_read"})
127
     */
128
    private $client;
129
    /**
130
     * @var \ControleOnline\Entity\Status
0 ignored issues
show
Bug introduced by
The type ControleOnline\Entity\Status was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
131
     *
132
     * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\Status")
133
     * @ORM\JoinColumns({
134
     *   @ORM\JoinColumn(name="task_status_id", referencedColumnName="id", nullable=true)
135
     * })
136
     * @Groups({"task_read","order_read"})
137
     */
138
    private $taskStatus;
139
    /**
140
     * @var \ControleOnline\Entity\Category
0 ignored issues
show
Bug introduced by
The type ControleOnline\Entity\Category was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
141
     *
142
     * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\Category")
143
     * @ORM\JoinColumns({
144
     *   @ORM\JoinColumn(name="category_id", referencedColumnName="id", nullable=false)
145
     * })
146
     * @Groups({"task_read","order_read"})
147
     */
148
    private $category;
149
    /**
150
     * @var \ControleOnline\Entity\Category
151
     *
152
     * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\Category")
153
     * @ORM\JoinColumns({
154
     *   @ORM\JoinColumn(name="reason_id", referencedColumnName="id", nullable=false)
155
     * })
156
     * @Groups({"task_read","order_read"})
157
     */
158
    private $reason;
159
    /**
160
     * @var \ControleOnline\Entity\Category
161
     *
162
     * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\Category")
163
     * @ORM\JoinColumns({
164
     *   @ORM\JoinColumn(name="criticality_id", referencedColumnName="id", nullable=false)
165
     * })
166
     * @Groups({"task_read","order_read"})
167
     */
168
    private $criticality;
169
    /**
170
     * @var \ControleOnline\Entity\People
171
     *
172
     * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\People")
173
     * @ORM\JoinColumns({
174
     *   @ORM\JoinColumn(name="provider_id", referencedColumnName="id", nullable=false)
175
     * })
176
     * @Groups({"task_read","order_read"})
177
     */
178
    private $provider;
179
    /**
180
     * @var \ControleOnline\Entity\SalesOrder
0 ignored issues
show
Bug introduced by
The type ControleOnline\Entity\SalesOrder was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
181
     *
182
     * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\SalesOrder", inversedBy="task")
183
     * @ORM\JoinColumns({
184
     *   @ORM\JoinColumn(name="order_id", referencedColumnName="id", nullable=true)
185
     * })
186
     * @Groups({"task_read"})
187
     */
188
    private $order;
189
    /**
190
     * @var \DateTimeInterface
191
     * @ORM\Column(name="created_at", type="datetime",  nullable=false, columnDefinition="DATETIME")
192
     * @Groups({"task_read","order_read"})
193
     */
194
    private $createdAt;
195
    /**
196
     * @var \DateTimeInterface
197
     * @ORM\Column(name="alter_date", type="datetime",  nullable=false, columnDefinition="DATETIME")
198
     * @Groups({"task_read","order_read"})
199
     */
200
    private $alterDate;
201
    /**
202
     * Constructor
203
     */
204
    public function __construct()
205
    {
206
        $this->createdAt = new \DateTime('now');
207
        $this->alterDate = new \DateTime('now');
208
    }
209
    /**
210
     * Get the value of id
211
     */
212
    public function getId()
213
    {
214
        return $this->id;
215
    }
216
    /**
217
     * Get the value of name
218
     */
219
    public function getName()
220
    {
221
        return $this->name;
222
    }
223
    /**
224
     * Set the value of name
225
     */
226
    public function setName($name): self
227
    {
228
        $this->name = $name;
229
        return $this;
230
    }
231
    /**
232
     * Get the value of dueDate
233
     */
234
    public function getDueDate()
235
    {
236
        return $this->dueDate;
237
    }
238
    /**
239
     * Set the value of dueDate
240
     */
241
    public function setDueDate($dueDate): self
242
    {
243
        $this->dueDate = $dueDate;
244
        return $this;
245
    }
246
    /**
247
     * Get the value of registeredBy
248
     */
249
    public function getRegisteredBy()
250
    {
251
        return $this->registeredBy;
252
    }
253
    /**
254
     * Set the value of registeredBy
255
     */
256
    public function setRegisteredBy($registeredBy): self
257
    {
258
        $this->registeredBy = $registeredBy;
259
        return $this;
260
    }
261
    /**
262
     * Get the value of taskFor
263
     */
264
    public function getTaskFor()
265
    {
266
        return $this->taskFor;
267
    }
268
    /**
269
     * Set the value of taskFor
270
     */
271
    public function setTaskFor($taskFor): self
272
    {
273
        $this->taskFor = $taskFor;
274
        return $this;
275
    }
276
    /**
277
     * Get the value of taskStatus
278
     */
279
    public function getTaskStatus()
280
    {
281
        return $this->taskStatus;
282
    }
283
    /**
284
     * Set the value of taskStatus
285
     */
286
    public function setTaskStatus($taskStatus): self
287
    {
288
        $this->taskStatus = $taskStatus;
289
        return $this;
290
    }
291
    /**
292
     * Get the value of Category
293
     */
294
    public function getCategory()
295
    {
296
        return $this->category;
297
    }
298
    /**
299
     * Set the value of Category
300
     */
301
    public function setCategory($category): self
302
    {
303
        $this->category = $category;
304
        return $this;
305
    }
306
    /**
307
     * Get the value of reason
308
     */
309
    public function getReason()
310
    {
311
        return $this->reason;
312
    }
313
    /**
314
     * Set the value of reason
315
     */
316
    public function setReason($reason): self
317
    {
318
        $this->reason = $reason;
319
        return $this;
320
    }
321
    /**
322
     * Get the value of criticality
323
     */
324
    public function getCriticality()
325
    {
326
        return $this->criticality;
327
    }
328
    /**
329
     * Set the value of criticality
330
     */
331
    public function setCriticality($criticality): self
332
    {
333
        $this->criticality = $criticality;
334
        return $this;
335
    }
336
    /**
337
     * Get the value of provider
338
     */
339
    public function getProvider()
340
    {
341
        return $this->provider;
342
    }
343
    /**
344
     * Set the value of provider
345
     */
346
    public function setProvider($provider): self
347
    {
348
        $this->provider = $provider;
349
        return $this;
350
    }
351
    /**
352
     * Get the value of client
353
     */
354
    public function getClient()
355
    {
356
        return $this->client;
357
    }
358
    /**
359
     * Set the value of client
360
     */
361
    public function setClient($client): self
362
    {
363
        $this->client = $client;
364
        return $this;
365
    }
366
    /**
367
     * Get the value of order
368
     */
369
    public function getOrder()
370
    {
371
        return $this->order;
372
    }
373
    /**
374
     * Set the value of order
375
     */
376
    public function setOrder($order): self
377
    {
378
        $this->order = $order;
379
        return $this;
380
    }
381
    /**
382
     * Get the value of createdAt
383
     */
384
    public function getCreatedAt()
385
    {
386
        return $this->createdAt;
387
    }
388
    /**
389
     * Get the value of alterDate
390
     */
391
    public function getAlterDate()
392
    {
393
        return $this->alterDate;
394
    }
395
    /**
396
     * Get the value of type
397
     */
398
    public function getType()
399
    {
400
        return $this->type;
401
    }
402
    /**
403
     * Set the value of type
404
     */
405
    public function setType($type): self
406
    {
407
        $this->type = $type;
408
        return $this;
409
    }
410
}
411