1 | <?php |
||
2 | |||
3 | namespace ControleOnline\Entity; |
||
4 | |||
5 | use Symfony\Component\Serializer\Attribute\Groups; |
||
0 ignored issues
–
show
|
|||
6 | |||
7 | use ApiPlatform\Doctrine\Orm\Filter\SearchFilter; |
||
0 ignored issues
–
show
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
8 | use ApiPlatform\Metadata\ApiFilter; |
||
0 ignored issues
–
show
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
9 | use ApiPlatform\Metadata\ApiResource; |
||
0 ignored issues
–
show
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
10 | use ApiPlatform\Metadata\Get; |
||
0 ignored issues
–
show
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
11 | use ApiPlatform\Metadata\GetCollection; |
||
0 ignored issues
–
show
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
12 | use ApiPlatform\Metadata\Post; |
||
0 ignored issues
–
show
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
13 | use ApiPlatform\Metadata\Put; |
||
0 ignored issues
–
show
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
14 | use ControleOnline\Listener\LogListener; |
||
0 ignored issues
–
show
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
15 | use ControleOnline\Repository\EmailRepository; |
||
16 | use Doctrine\ORM\Mapping as ORM; |
||
0 ignored issues
–
show
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
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' => ['email:read']], |
||
25 | denormalizationContext: ['groups' => ['email:write']] |
||
26 | ), |
||
27 | new Post(securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')'), |
||
28 | ], |
||
29 | formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
||
30 | normalizationContext: ['groups' => ['email:read']], |
||
31 | denormalizationContext: ['groups' => ['email:write']] |
||
32 | )] |
||
33 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['people' => 'exact'])] |
||
34 | #[ORM\Table(name: 'email')] |
||
35 | #[ORM\Index(columns: ['people_id'])] |
||
36 | #[ORM\UniqueConstraint(name: 'email', columns: ['email'])] |
||
37 | #[ORM\EntityListeners([LogListener::class])] |
||
38 | #[ORM\Entity(repositoryClass: EmailRepository::class)] |
||
39 | class Email |
||
40 | { |
||
41 | #[ORM\Column(type: 'integer', nullable: false)] |
||
42 | #[ORM\Id] |
||
43 | #[ORM\GeneratedValue(strategy: 'IDENTITY')] |
||
44 | private int $id = 0; |
||
45 | |||
46 | #[ORM\Column(type: 'string', length: 50, nullable: false)] |
||
47 | #[Groups(['invoice_details:read', 'order_details:read', 'order:write', 'people:read', 'email:read', 'get_contracts', 'carrier:read', 'email:write'])] |
||
48 | private string $email; |
||
49 | |||
50 | #[ORM\Column(type: 'boolean', nullable: false)] |
||
51 | private bool $confirmed = false; |
||
52 | |||
53 | #[ORM\Column(type: 'string', length: 50, nullable: true)] |
||
54 | #[Groups(['invoice_details:read', 'order_details:read', 'order:write', 'people:read', 'email:read', 'get_contracts', 'carrier:read'])] |
||
55 | private ?string $types = null; |
||
56 | |||
57 | #[ORM\JoinColumn(name: 'people_id', referencedColumnName: 'id')] |
||
58 | #[ORM\ManyToOne(targetEntity: People::class, inversedBy: 'email')] |
||
59 | #[Groups(['email:read'])] |
||
60 | private ?People $people = null; |
||
61 | |||
62 | public function getId(): int |
||
63 | { |
||
64 | return $this->id; |
||
65 | } |
||
66 | |||
67 | public function setEmail(string $email): self |
||
68 | { |
||
69 | $this->email = trim($email); |
||
70 | return $this; |
||
71 | } |
||
72 | |||
73 | public function getEmail(): string |
||
74 | { |
||
75 | return $this->email; |
||
76 | } |
||
77 | |||
78 | public function getTypes(): object |
||
79 | { |
||
80 | return $this->types ? json_decode($this->types) : new \stdClass(); |
||
81 | } |
||
82 | |||
83 | public function addType(string $key, mixed $value): self |
||
84 | { |
||
85 | $types = $this->getTypes(); |
||
86 | $types->$key = $value; |
||
87 | $this->types = json_encode($types); |
||
88 | return $this; |
||
89 | } |
||
90 | |||
91 | public function setTypes(object $types): self |
||
92 | { |
||
93 | $this->types = json_encode($types); |
||
94 | return $this; |
||
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 | } |
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