Phone::setConfirmed()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 2
b 0
f 0
nc 1
nop 1
dl 0
loc 4
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
7
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...
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\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...
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 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...
15
16
use ControleOnline\Repository\PhoneRepository;
17
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...
18
19
#[ApiResource(
20
    operations: [
21
        new Get(security: "is_granted('ROLE_CLIENT')"),
22
        new GetCollection(security: "is_granted('ROLE_CLIENT')"),
23
        new Put(
24
            security: "is_granted('ROLE_ADMIN') or is_granted('ROLE_CLIENT')",
25
            validationContext: ['groups' => ['phone:read']],
26
            denormalizationContext: ['groups' => ['phone:write']]
27
        ),
28
        new Post(securityPostDenormalize: "is_granted('ROLE_CLIENT')"),
29
        new Delete(security: "is_granted('ROLE_CLIENT')")
30
    ],
31
    formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']],
32
    normalizationContext: ['groups' => ['phone:read']],
33
    denormalizationContext: ['groups' => ['phone:write']],
34
)]
35
#[ORM\Table(name: 'phone')]
36
#[ORM\Index(columns: ['people_id'])]
37
#[ORM\UniqueConstraint(name: 'phone', columns: ['phone', 'ddd', 'people_id'])]
38
39
#[ORM\Entity(repositoryClass: PhoneRepository::class)]
40
class Phone
41
{
42
    #[ORM\Column(type: 'integer', nullable: false)]
43
    #[ORM\Id]
44
    #[ORM\GeneratedValue(strategy: 'IDENTITY')]
45
    #[Groups(['connections:read', 'phone:read', 'phone:write'])]
46
    private int $id = 0;
47
48
    #[ORM\Column(type: 'integer', length: 10, nullable: false)]
49
    #[Groups(['invoice_details:read', 'order_details:read', 'order:write', 'people:read', 'connections:read', 'phone:read', 'phone:write'])]
50
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['phone' => 'exact'])]
51
    private int $phone;
52
53
    #[ORM\Column(type: 'integer', length: 2, nullable: false)]
54
    #[Groups(['invoice_details:read', 'order_details:read', 'order:write', 'people:read', 'connections:read', 'phone:read', 'phone:write'])]
55
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['ddi' => 'exact'])]
56
57
    private int $ddi;
58
59
60
    #[ORM\Column(type: 'integer', length: 2, nullable: false)]
61
    #[Groups(['invoice_details:read', 'order_details:read', 'order:write', 'people:read', 'connections:read', 'phone:read', 'phone:write'])]
62
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['ddd' => 'exact'])]
63
    private int $ddd;
64
65
    #[ORM\Column(type: 'boolean', nullable: false)]
66
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['confirmed' => 'exact'])]
67
68
    private bool $confirmed = false;
69
70
    #[ORM\JoinColumn(name: 'people_id', referencedColumnName: 'id')]
71
    #[ORM\ManyToOne(targetEntity: People::class, inversedBy: 'phone')]
72
    #[Groups(['connections:read', 'phone:read', 'phone:write'])]
73
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['people' => 'exact'])]
74
75
    private ?People $people = null;
76
77
    public function getId(): int
78
    {
79
        return $this->id;
80
    }
81
82
    public function setDdd(int $ddd): self
83
    {
84
        $this->ddd = $ddd;
85
        return $this;
86
    }
87
88
    public function getDdd(): int
89
    {
90
        return $this->ddd;
91
    }
92
93
    public function setPhone(int $phone): self
94
    {
95
        $this->phone = $phone;
96
        return $this;
97
    }
98
99
    public function getPhone(): int
100
    {
101
        return $this->phone;
102
    }
103
104
    public function setConfirmed(bool $confirmed): self
105
    {
106
        $this->confirmed = $confirmed;
107
        return $this;
108
    }
109
110
    public function getConfirmed(): bool
111
    {
112
        return $this->confirmed;
113
    }
114
115
    public function setPeople(?People $people): self
116
    {
117
        $this->people = $people;
118
        return $this;
119
    }
120
121
    public function getPeople(): ?People
122
    {
123
        return $this->people;
124
    }
125
126
    public function getDdi(): int
127
    {
128
        return $this->ddi;
129
    }
130
131
    public function setDdi(int $ddi): self
132
    {
133
        $this->ddi = $ddi;
134
135
        return $this;
136
    }
137
}
138