1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace ControleOnline\Entity; |
4
|
|
|
|
5
|
|
|
use Symfony\Component\Serializer\Attribute\Groups; |
|
|
|
|
6
|
|
|
|
7
|
|
|
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter; |
|
|
|
|
8
|
|
|
use ApiPlatform\Metadata\ApiFilter; |
|
|
|
|
9
|
|
|
use ApiPlatform\Metadata\ApiResource; |
|
|
|
|
10
|
|
|
use ApiPlatform\Metadata\Get; |
|
|
|
|
11
|
|
|
use ApiPlatform\Metadata\GetCollection; |
|
|
|
|
12
|
|
|
use ApiPlatform\Metadata\Post; |
|
|
|
|
13
|
|
|
use ApiPlatform\Metadata\Put; |
|
|
|
|
14
|
|
|
use ControleOnline\Listener\LogListener; |
|
|
|
|
15
|
|
|
use ControleOnline\Repository\PhoneRepository; |
16
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
|
|
|
17
|
|
|
|
18
|
|
|
#[ApiResource( |
19
|
|
|
operations: [ |
20
|
|
|
new Get(security: 'is_granted(\'ROLE_CLIENT\')'), |
21
|
|
|
new GetCollection(security: 'is_granted(\'ROLE_CLIENT\')'), |
22
|
|
|
new Put( |
23
|
|
|
security: 'is_granted(\'ROLE_ADMIN\') or (is_granted(\'ROLE_CLIENT\'))', |
24
|
|
|
validationContext: ['groups' => ['phone:read']], |
25
|
|
|
denormalizationContext: ['groups' => ['phone:write']] |
26
|
|
|
), |
27
|
|
|
new Post(securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')') |
28
|
|
|
], |
29
|
|
|
formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
30
|
|
|
normalizationContext: ['groups' => ['phone:read']], |
31
|
|
|
denormalizationContext: ['groups' => ['phone:write']], |
32
|
|
|
)] |
33
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['people' => 'exact'])] |
34
|
|
|
#[ORM\Table(name: 'phone')] |
35
|
|
|
#[ORM\Index(columns: ['people_id'])] |
36
|
|
|
#[ORM\UniqueConstraint(name: 'phone', columns: ['phone', 'ddd', 'people_id'])] |
37
|
|
|
#[ORM\EntityListeners([LogListener::class])] |
38
|
|
|
#[ORM\Entity(repositoryClass: PhoneRepository::class)] |
39
|
|
|
class Phone |
40
|
|
|
{ |
41
|
|
|
#[ORM\Column(type: 'integer', nullable: false)] |
42
|
|
|
#[ORM\Id] |
43
|
|
|
#[ORM\GeneratedValue(strategy: 'IDENTITY')] |
44
|
|
|
#[Groups(['connections:read', 'phone:read', 'phone:write'])] |
45
|
|
|
private int $id = 0; |
46
|
|
|
|
47
|
|
|
#[ORM\Column(type: 'integer', length: 10, nullable: false)] |
48
|
|
|
#[Groups(['invoice_details:read', 'order_details:read', 'order:write', 'people:read', 'connections:read', 'phone:read', 'phone:write'])] |
49
|
|
|
private int $phone; |
50
|
|
|
|
51
|
|
|
#[ORM\Column(type: 'integer', length: 2, nullable: false)] |
52
|
|
|
#[Groups(['invoice_details:read', 'order_details:read', 'order:write', 'people:read', 'connections:read', 'phone:read', 'phone:write'])] |
53
|
|
|
private int $ddi; |
54
|
|
|
|
55
|
|
|
|
56
|
|
|
#[ORM\Column(type: 'integer', length: 2, nullable: false)] |
57
|
|
|
#[Groups(['invoice_details:read', 'order_details:read', 'order:write', 'people:read', 'connections:read', 'phone:read', 'phone:write'])] |
58
|
|
|
private int $ddd; |
59
|
|
|
|
60
|
|
|
#[ORM\Column(type: 'boolean', nullable: false)] |
61
|
|
|
private bool $confirmed = false; |
62
|
|
|
|
63
|
|
|
#[ORM\JoinColumn(name: 'people_id', referencedColumnName: 'id')] |
64
|
|
|
#[ORM\ManyToOne(targetEntity: People::class, inversedBy: 'phone')] |
65
|
|
|
#[Groups(['connections:read', 'phone:read', 'phone:write'])] |
66
|
|
|
private ?People $people = null; |
67
|
|
|
|
68
|
|
|
public function getId(): int |
69
|
|
|
{ |
70
|
|
|
return $this->id; |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
public function setDdd(int $ddd): self |
74
|
|
|
{ |
75
|
|
|
$this->ddd = $ddd; |
76
|
|
|
return $this; |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
public function getDdd(): int |
80
|
|
|
{ |
81
|
|
|
return $this->ddd; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
public function setPhone(int $phone): self |
85
|
|
|
{ |
86
|
|
|
$this->phone = $phone; |
87
|
|
|
return $this; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
public function getPhone(): int |
91
|
|
|
{ |
92
|
|
|
return $this->phone; |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
public function setConfirmed(bool $confirmed): self |
96
|
|
|
{ |
97
|
|
|
$this->confirmed = $confirmed; |
98
|
|
|
return $this; |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
public function getConfirmed(): bool |
102
|
|
|
{ |
103
|
|
|
return $this->confirmed; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
public function setPeople(?People $people): self |
107
|
|
|
{ |
108
|
|
|
$this->people = $people; |
109
|
|
|
return $this; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
public function getPeople(): ?People |
113
|
|
|
{ |
114
|
|
|
return $this->people; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
public function getDdi(): int |
118
|
|
|
{ |
119
|
|
|
return $this->ddi; |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
public function setDdi(int $ddi): self |
123
|
|
|
{ |
124
|
|
|
$this->ddi = $ddi; |
125
|
|
|
|
126
|
|
|
return $this; |
127
|
|
|
} |
128
|
|
|
} |
129
|
|
|
|
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths