Passed
Push — master ( a1b634...d2b1ec )
by Luiz Kim
03:23 queued 54s
created

Connections::getId()   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
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
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
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...
7
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...
8
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...
9
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...
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\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...
12
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...
13
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...
14
use ControleOnline\Listener\LogListener;
15
use ControleOnline\Repository\ConnectionsRepository;
0 ignored issues
show
Bug introduced by
The type ControleOnline\Repository\ConnectionsRepository 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 Doctrine\ORM\Mapping\Column;
0 ignored issues
show
Bug introduced by
The type Doctrine\ORM\Mapping\Column 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\ORM\Mapping\Entity;
0 ignored issues
show
Bug introduced by
The type Doctrine\ORM\Mapping\Entity 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\ORM\Mapping\EntityListeners;
0 ignored issues
show
Bug introduced by
The type Doctrine\ORM\Mapping\EntityListeners 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 Doctrine\ORM\Mapping\GeneratedValue;
0 ignored issues
show
Bug introduced by
The type Doctrine\ORM\Mapping\GeneratedValue 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
use Doctrine\ORM\Mapping\Id;
0 ignored issues
show
Bug introduced by
The type Doctrine\ORM\Mapping\Id 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...
21
use Doctrine\ORM\Mapping\JoinColumn;
0 ignored issues
show
Bug introduced by
The type Doctrine\ORM\Mapping\JoinColumn 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...
22
use Doctrine\ORM\Mapping\ManyToOne;
0 ignored issues
show
Bug introduced by
The type Doctrine\ORM\Mapping\ManyToOne 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...
23
use Doctrine\ORM\Mapping\Table;
0 ignored issues
show
Bug introduced by
The type Doctrine\ORM\Mapping\Table 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...
24
25
#[ApiResource(
26
    operations: [
27
        new Get(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')'),
28
        new Delete(security: 'is_granted(\'ROLE_CLIENT\')'),
29
        new GetCollection(security: 'is_granted(\'ROLE_CLIENT\')'),
30
        new Post(security: 'is_granted(\'ROLE_CLIENT\')'),
31
        new Put(
32
            security: 'is_granted(\'ROLE_CLIENT\')',
33
            denormalizationContext: ['groups' => ['connections:write']]
34
        ),
35
    ],
36
    formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']],
37
    normalizationContext: ['groups' => ['connections:read']],
38
    denormalizationContext: ['groups' => ['connections:write']]
39
)]
40
#[Table(name: 'connections')]
41
#[EntityListeners([LogListener::class])]
42
#[Entity(repositoryClass: ConnectionRepository::class)]
43
class Connection
44
{
45
    #[Groups(['connections:read'])]
46
    #[Column(name: 'id', type: 'integer', nullable: false)]
47
    #[Id]
48
    #[GeneratedValue(strategy: 'IDENTITY')]
49
    private int $id = 0;
50
51
    #[Groups(['connections:read', 'connections:write'])]
52
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['people' => 'exact'])]
53
    #[JoinColumn(name: 'people_id', referencedColumnName: 'id', nullable: false)]
54
    #[ManyToOne(targetEntity: People::class)]
55
    private ?People $people = null;
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...
56
57
    #[Groups(['connections:read', 'connections:write'])]
58
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['status' => 'exact'])]
59
    #[JoinColumn(name: 'status_id', referencedColumnName: 'id', nullable: false)]
60
    #[ManyToOne(targetEntity: Status::class)]
61
    private ?Status $status = null;
62
63
    #[Groups(['connections:read', 'connections:write'])]
64
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['name' => 'exact'])]
65
    #[Column(name: 'name', type: 'string', length: 50, nullable: false)]
66
    private string $name;
67
68
    #[Groups(['connections:read', 'connections:write'])]
69
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['phone' => 'exact'])]
70
    #[JoinColumn(name: 'phone_id', referencedColumnName: 'id', nullable: true)]
71
    #[ManyToOne(targetEntity: Phone::class)]
72
    private ?Phone $phone = null;
0 ignored issues
show
Bug introduced by
The type ControleOnline\Entity\Phone 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...
73
74
    #[Groups(['connections:read', 'connections:write'])]
75
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['channel' => 'exact'])]
76
    #[Column(name: 'channel', type: 'string', columnDefinition: "ENUM('whatsapp')", nullable: false)]
77
    private string $channel;
78
79
    // Getters e Setters
80
81
    public function getId(): int
82
    {
83
        return $this->id;
84
    }
85
86
    public function getPeople(): ?People
87
    {
88
        return $this->people;
89
    }
90
91
    public function setPeople(?People $people): self
92
    {
93
        $this->people = $people;
94
        return $this;
95
    }
96
97
    public function getStatus(): ?Status
98
    {
99
        return $this->status;
100
    }
101
102
    public function setStatus(?Status $status): self
103
    {
104
        $this->status = $status;
105
        return $this;
106
    }
107
108
    public function getName(): string
109
    {
110
        return $this->name;
111
    }
112
113
    public function setName(string $name): self
114
    {
115
        $this->name = $name;
116
        return $this;
117
    }
118
119
    public function getPhone(): ?Phone
120
    {
121
        return $this->phone;
122
    }
123
124
    public function setPhone(?Phone $phone): self
125
    {
126
        $this->phone = $phone;
127
        return $this;
128
    }
129
130
    public function getChannel(): string
131
    {
132
        return $this->channel;
133
    }
134
135
    public function setChannel(string $channel): self
136
    {
137
        $this->channel = $channel;
138
        return $this;
139
    }
140
}