Passed
Push — master ( 3bdad8...afbf6b )
by Luiz Kim
02:14
created

TaskInteration::getNotified()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace ControleOnline\Entity;
4
5
use Symfony\Component\Serializer\Attribute\Groups;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Serializer\Attribute\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...
6
7
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...
8
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...
9
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...
10
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...
11
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...
12
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...
13
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...
14
use 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...
15
use ControleOnline\Entity\Task;
16
use ControleOnline\Entity\File;
0 ignored issues
show
Bug introduced by
The type ControleOnline\Entity\File 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 ControleOnline\Repository\TaskInterationRepository;
18
use ControleOnline\Listener\LogListener;
0 ignored issues
show
Bug introduced by
The type ControleOnline\Listener\LogListener 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 DateTime;
20
use DateTimeInterface;
21
22
#[ORM\Table(name: 'task_interations')]
23
#[ORM\EntityListeners([LogListener::class])]
24
#[ORM\Entity(repositoryClass: TaskInterationRepository::class)]
25
#[ApiResource(
26
    formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => 'text/csv'],
27
    normalizationContext: ['groups' => ['task_interaction:read']],
28
    denormalizationContext: ['groups' => ['task_interaction:write']],
29
    security: "is_granted('ROLE_CLIENT')",
30
    operations: [
31
        new GetCollection(security: "is_granted('ROLE_CLIENT')"),
32
        new Get(security: "is_granted('ROLE_CLIENT')"),
33
        new Post(security: "is_granted('ROLE_ADMIN') or is_granted('ROLE_CLIENT')")
34
    ]
35
)]
36
#[ApiFilter(SearchFilter::class, properties: [
37
    'task' => 'exact',
38
    'task.id' => 'exact',
39
    'task.taskFor' => 'exact',
40
    'registeredBy' => 'exact',
41
    'type' => 'exact',
42
    'visibility' => 'exact',
43
    'read' => 'exact'
44
])]
45
class TaskInteration
46
{
47
    #[ORM\Column(type: 'integer', nullable: false)]
48
    #[ORM\Id]
49
    #[ORM\GeneratedValue(strategy: 'IDENTITY')]
50
    #[Groups(['task_interaction:read'])]
51
    private $id;
52
53
    #[ORM\Column(type: 'string', length: 50, nullable: false)]
54
    #[Groups(['task_interaction:read', 'task_interaction:write'])]
55
    private $type;
56
57
    #[ORM\Column(name: 'visibility', type: 'string', length: 50, nullable: false)]
58
    #[Groups(['task_interaction:read', 'task_interaction:write'])]
59
    private $visibility;
60
61
    #[ORM\Column(type: 'string', nullable: true)]
62
    #[Groups(['task_interaction:read', 'task_interaction:write'])]
63
    private $body;
64
65
    #[ORM\ManyToOne(targetEntity: People::class)]
66
    #[ORM\JoinColumn(name: 'registered_by_id', referencedColumnName: 'id', nullable: false)]
67
    #[Groups(['task_interaction:read', 'task_interaction:write'])]
68
    private $registeredBy;
69
70
    #[ORM\ManyToOne(targetEntity: Task::class)]
71
    #[ORM\JoinColumn(name: 'task_id', referencedColumnName: 'id', nullable: true)]
72
    #[Groups(['task_interaction:read', 'task_interaction:write'])]
73
    private $task;
74
75
    #[ORM\ManyToOne(targetEntity: File::class)]
76
    #[ORM\JoinColumn(name: 'file_id', referencedColumnName: 'id', nullable: true)]
77
    #[Groups(['task_interaction:read', 'task_interaction:write'])]
78
    private $file;
79
80
    #[ORM\Column(name: 'created_at', type: 'datetime', nullable: false, columnDefinition: 'DATETIME')]
81
    #[Groups(['task_interaction:read', 'task_interaction:write'])]
82
    private $createdAt;
83
84
    #[ORM\Column(name: 'read', type: 'integer', nullable: false)]
85
    #[Groups(['task_interaction:read', 'task_interaction:write'])]
86
    private $read;
87
88
    #[ORM\Column(name: 'notified', type: 'integer', nullable: false)]
89
    #[Groups(['task_interaction:read', 'task_interaction:write'])]
90
    private $notified;
91
92
    public function __construct()
93
    {
94
        $this->createdAt = new DateTime('now');
95
        $this->visibility = 'private';
96
        $this->read = 0;
97
        $this->notified = 0;
98
    }
99
100
    public function getId()
101
    {
102
        return $this->id;
103
    }
104
105
    public function getType()
106
    {
107
        return $this->type;
108
    }
109
110
    public function setType($type): self
111
    {
112
        $this->type = $type;
113
        return $this;
114
    }
115
116
    public function getBody()
117
    {
118
        return $this->body;
119
    }
120
121
    public function setBody($body)
122
    {
123
        $this->body = $body;
124
        return $this;
125
    }
126
127
    public function getRegisteredBy()
128
    {
129
        return $this->registeredBy;
130
    }
131
132
    public function setRegisteredBy($registeredBy): self
133
    {
134
        $this->registeredBy = $registeredBy;
135
        return $this;
136
    }
137
138
    public function getTask()
139
    {
140
        return $this->task;
141
    }
142
143
    public function setTask($task): self
144
    {
145
        $this->task = $task;
146
        return $this;
147
    }
148
149
    public function getFile()
150
    {
151
        return $this->file;
152
    }
153
154
    public function setFile($file): self
155
    {
156
        $this->file = $file;
157
        return $this;
158
    }
159
160
    public function getCreatedAt(): DateTimeInterface
161
    {
162
        return $this->createdAt;
163
    }
164
165
    public function setCreatesAt(DateTimeInterface $createdAt): self
166
    {
167
        $this->createdAt = $createdAt;
168
        return $this;
169
    }
170
171
172
    public function getVisibility()
173
    {
174
        return $this->visibility;
175
    }
176
177
    public function setVisibility($visibility): self
178
    {
179
        $this->visibility = $visibility;
180
        return $this;
181
    }
182
183
    public function getRead()
184
    {
185
        return $this->read;
186
    }
187
188
    public function setRead($read)
189
    {
190
        $this->read = $read;
191
        return $this;
192
    }
193
194
    public function getNotified()
195
    {
196
        return $this->notified;
197
    }
198
199
    public function setNotified($notified): self
200
    {
201
        $this->notified = $notified;
202
203
        return $this;
204
    }
205
}
206