Phone::getId()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 3
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
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
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...
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
#[ApiFilter(filterClass: SearchFilter::class, properties: ['people' => 'exact'])]
36
#[ORM\Table(name: 'phone')]
37
#[ORM\Index(columns: ['people_id'])]
38
#[ORM\UniqueConstraint(name: 'phone', columns: ['phone', 'ddd', 'people_id'])]
39
#[ORM\EntityListeners([LogListener::class])]
40
#[ORM\Entity(repositoryClass: PhoneRepository::class)]
41
class Phone
42
{
43
    #[ORM\Column(type: 'integer', nullable: false)]
44
    #[ORM\Id]
45
    #[ORM\GeneratedValue(strategy: 'IDENTITY')]
46
    #[Groups(['connections:read', 'phone:read', 'phone:write'])]
47
    private int $id = 0;
48
49
    #[ORM\Column(type: 'integer', length: 10, nullable: false)]
50
    #[Groups(['invoice_details:read', 'order_details:read', 'order:write', 'people:read', 'connections:read', 'phone:read', 'phone:write'])]
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
    private int $ddi;
56
57
58
    #[ORM\Column(type: 'integer', length: 2, nullable: false)]
59
    #[Groups(['invoice_details:read', 'order_details:read', 'order:write', 'people:read', 'connections:read', 'phone:read', 'phone:write'])]
60
    private int $ddd;
61
62
    #[ORM\Column(type: 'boolean', nullable: false)]
63
    private bool $confirmed = false;
64
65
    #[ORM\JoinColumn(name: 'people_id', referencedColumnName: 'id')]
66
    #[ORM\ManyToOne(targetEntity: People::class, inversedBy: 'phone')]
67
    #[Groups(['connections:read', 'phone:read', 'phone:write'])]
68
    private ?People $people = null;
69
70
    public function getId(): int
71
    {
72
        return $this->id;
73
    }
74
75
    public function setDdd(int $ddd): self
76
    {
77
        $this->ddd = $ddd;
78
        return $this;
79
    }
80
81
    public function getDdd(): int
82
    {
83
        return $this->ddd;
84
    }
85
86
    public function setPhone(int $phone): self
87
    {
88
        $this->phone = $phone;
89
        return $this;
90
    }
91
92
    public function getPhone(): int
93
    {
94
        return $this->phone;
95
    }
96
97
    public function setConfirmed(bool $confirmed): self
98
    {
99
        $this->confirmed = $confirmed;
100
        return $this;
101
    }
102
103
    public function getConfirmed(): bool
104
    {
105
        return $this->confirmed;
106
    }
107
108
    public function setPeople(?People $people): self
109
    {
110
        $this->people = $people;
111
        return $this;
112
    }
113
114
    public function getPeople(): ?People
115
    {
116
        return $this->people;
117
    }
118
119
    public function getDdi(): int
120
    {
121
        return $this->ddi;
122
    }
123
124
    public function setDdi(int $ddi): self
125
    {
126
        $this->ddi = $ddi;
127
128
        return $this;
129
    }
130
}
131