|
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 ApiPlatform\Metadata\Delete; |
|
|
|
|
|
|
15
|
|
|
use ControleOnline\Listener\LogListener; |
|
|
|
|
|
|
16
|
|
|
use ControleOnline\Repository\EmailRepository; |
|
17
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
|
|
|
|
|
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' => ['email:read']], |
|
26
|
|
|
denormalizationContext: ['groups' => ['email: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' => ['email:read']], |
|
33
|
|
|
denormalizationContext: ['groups' => ['email:write']] |
|
34
|
|
|
)] |
|
35
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['people' => 'exact'])] |
|
36
|
|
|
#[ORM\Table(name: 'email')] |
|
37
|
|
|
#[ORM\Index(columns: ['people_id'])] |
|
38
|
|
|
#[ORM\UniqueConstraint(name: 'email', columns: ['email'])] |
|
39
|
|
|
#[ORM\EntityListeners([LogListener::class])] |
|
40
|
|
|
#[ORM\Entity(repositoryClass: EmailRepository::class)] |
|
41
|
|
|
class Email |
|
42
|
|
|
{ |
|
43
|
|
|
#[ORM\Column(type: 'integer', nullable: false)] |
|
44
|
|
|
#[ORM\Id] |
|
45
|
|
|
#[ORM\GeneratedValue(strategy: 'IDENTITY')] |
|
46
|
|
|
private int $id = 0; |
|
47
|
|
|
|
|
48
|
|
|
#[ORM\Column(type: 'string', length: 50, nullable: false)] |
|
49
|
|
|
#[Groups(['invoice_details:read', 'order_details:read', 'order:write', 'people:read', 'email:read', 'get_contracts', 'carrier:read', 'email:write'])] |
|
50
|
|
|
private string $email; |
|
51
|
|
|
|
|
52
|
|
|
#[ORM\Column(type: 'boolean', nullable: false)] |
|
53
|
|
|
private bool $confirmed = false; |
|
54
|
|
|
|
|
55
|
|
|
#[ORM\Column(type: 'string', length: 50, nullable: true)] |
|
56
|
|
|
#[Groups(['invoice_details:read', 'order_details:read', 'order:write', 'people:read', 'email:read', 'get_contracts', 'carrier:read'])] |
|
57
|
|
|
private ?string $types = null; |
|
58
|
|
|
|
|
59
|
|
|
#[ORM\JoinColumn(name: 'people_id', referencedColumnName: 'id')] |
|
60
|
|
|
#[ORM\ManyToOne(targetEntity: People::class, inversedBy: 'email')] |
|
61
|
|
|
#[Groups(['email:read'])] |
|
62
|
|
|
private ?People $people = null; |
|
63
|
|
|
|
|
64
|
|
|
public function getId(): int |
|
65
|
|
|
{ |
|
66
|
|
|
return $this->id; |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
public function setEmail(string $email): self |
|
70
|
|
|
{ |
|
71
|
|
|
$this->email = trim($email); |
|
72
|
|
|
return $this; |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
public function getEmail(): string |
|
76
|
|
|
{ |
|
77
|
|
|
return $this->email; |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
public function getTypes(): object |
|
81
|
|
|
{ |
|
82
|
|
|
return $this->types ? json_decode($this->types) : new \stdClass(); |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
|
|
public function addType(string $key, mixed $value): self |
|
86
|
|
|
{ |
|
87
|
|
|
$types = $this->getTypes(); |
|
88
|
|
|
$types->$key = $value; |
|
89
|
|
|
$this->types = json_encode($types); |
|
90
|
|
|
return $this; |
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
|
|
public function setTypes(object $types): self |
|
94
|
|
|
{ |
|
95
|
|
|
$this->types = json_encode($types); |
|
96
|
|
|
return $this; |
|
97
|
|
|
} |
|
98
|
|
|
|
|
99
|
|
|
public function setConfirmed(bool $confirmed): self |
|
100
|
|
|
{ |
|
101
|
|
|
$this->confirmed = $confirmed; |
|
102
|
|
|
return $this; |
|
103
|
|
|
} |
|
104
|
|
|
|
|
105
|
|
|
public function getConfirmed(): bool |
|
106
|
|
|
{ |
|
107
|
|
|
return $this->confirmed; |
|
108
|
|
|
} |
|
109
|
|
|
|
|
110
|
|
|
public function setPeople(?People $people): self |
|
111
|
|
|
{ |
|
112
|
|
|
$this->people = $people; |
|
113
|
|
|
return $this; |
|
114
|
|
|
} |
|
115
|
|
|
|
|
116
|
|
|
public function getPeople(): ?People |
|
117
|
|
|
{ |
|
118
|
|
|
return $this->people; |
|
119
|
|
|
} |
|
120
|
|
|
} |
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