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 ControleOnline\Listener\LogListener; |
14
|
|
|
use ControleOnline\Repository\AddressRepository; |
15
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
|
|
|
16
|
|
|
|
17
|
|
|
#[ApiResource( |
18
|
|
|
operations: [ |
19
|
|
|
new Get(security: 'is_granted(\'ROLE_CLIENT\')'), |
20
|
|
|
new GetCollection(security: 'is_granted(\'ROLE_CLIENT\')'), |
21
|
|
|
new Post(securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')'), |
22
|
|
|
], |
23
|
|
|
formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
24
|
|
|
normalizationContext: ['groups' => ['address:read']], |
25
|
|
|
denormalizationContext: ['groups' => ['address:write']] |
26
|
|
|
)] |
27
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['people' => 'exact'])] |
28
|
|
|
#[ORM\Table(name: 'address')] |
29
|
|
|
#[ORM\Index(name: 'user_id_2', columns: ['people_id', 'nickname'])] |
30
|
|
|
#[ORM\Index(name: 'user_id', columns: ['people_id'])] |
31
|
|
|
#[ORM\Index(name: 'cep_id', columns: ['street_id'])] |
32
|
|
|
#[ORM\UniqueConstraint(name: 'user_id_3', columns: ['people_id', 'number', 'street_id', 'complement'])] |
33
|
|
|
#[ORM\EntityListeners([LogListener::class])] |
34
|
|
|
#[ORM\Entity(repositoryClass: AddressRepository::class)] |
35
|
|
|
class Address |
36
|
|
|
{ |
37
|
|
|
#[ORM\Column(name: 'id', type: 'integer', nullable: false)] |
38
|
|
|
#[ORM\Id] |
39
|
|
|
#[ORM\GeneratedValue(strategy: 'IDENTITY')] |
40
|
|
|
#[Groups(['people:read', 'order_details:read', 'order:write', 'address:read'])] |
41
|
|
|
private $id; |
42
|
|
|
|
43
|
|
|
#[ORM\Column(name: 'number', type: 'integer', nullable: true)] |
44
|
|
|
#[Groups(['people:read', 'order_details:read', 'order:write', 'address:read'])] |
45
|
|
|
private $number; |
46
|
|
|
|
47
|
|
|
#[ORM\Column(name: 'nickname', type: 'string', length: 50, nullable: false)] |
48
|
|
|
#[Groups(['people:read', 'order_details:read', 'order:write', 'address:read'])] |
49
|
|
|
private $nickname; |
50
|
|
|
|
51
|
|
|
#[ORM\Column(name: 'complement', type: 'string', length: 50, nullable: false)] |
52
|
|
|
#[Groups(['people:read', 'order_details:read', 'order:write', 'address:read'])] |
53
|
|
|
private $complement; |
54
|
|
|
|
55
|
|
|
#[ORM\JoinColumn(name: 'people_id', referencedColumnName: 'id', nullable: true)] |
56
|
|
|
#[ORM\ManyToOne(targetEntity: People::class, inversedBy: 'address')] |
57
|
|
|
private $people; |
58
|
|
|
|
59
|
|
|
#[ORM\JoinColumn(name: 'street_id', referencedColumnName: 'id', nullable: false)] |
60
|
|
|
#[ORM\ManyToOne(targetEntity: Street::class, inversedBy: 'address')] |
61
|
|
|
#[Groups(['people:read', 'order_details:read', 'order:write', 'address:read'])] |
62
|
|
|
private $street; |
63
|
|
|
|
64
|
|
|
#[ORM\Column(name: 'latitude', type: 'float', nullable: false)] |
65
|
|
|
#[Groups(['people:read'])] |
66
|
|
|
private $latitude; |
67
|
|
|
|
68
|
|
|
#[ORM\Column(name: 'longitude', type: 'float', nullable: false)] |
69
|
|
|
#[Groups(['people:read'])] |
70
|
|
|
private $longitude; |
71
|
|
|
|
72
|
|
|
#[ORM\Column(name: 'locator', type: 'string', nullable: false)] |
73
|
|
|
#[Groups(['people:read'])] |
74
|
|
|
private $locator; |
75
|
|
|
|
76
|
|
|
#[ORM\Column(name: 'opening_time', type: 'time', nullable: false)] |
77
|
|
|
#[Groups(['people:read'])] |
78
|
|
|
private $opening_time; |
79
|
|
|
|
80
|
|
|
#[ORM\Column(name: 'closing_time', type: 'time', nullable: false)] |
81
|
|
|
#[Groups(['people:read'])] |
82
|
|
|
private $closing_time; |
83
|
|
|
|
84
|
|
|
#[ORM\Column(name: 'search_for', type: 'string', nullable: false)] |
85
|
|
|
#[Groups(['people:read'])] |
86
|
|
|
private $search_for; |
87
|
|
|
|
88
|
|
|
public function __construct() |
89
|
|
|
{ |
90
|
|
|
$this->latitude = 0; |
91
|
|
|
$this->longitude = 0; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
public function getId() |
95
|
|
|
{ |
96
|
|
|
return $this->id; |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
public function setNumber($number) |
100
|
|
|
{ |
101
|
|
|
$this->number = $number; |
102
|
|
|
return $this; |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
public function getNumber() |
106
|
|
|
{ |
107
|
|
|
return $this->number; |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
public function setNickname($nickname) |
111
|
|
|
{ |
112
|
|
|
$this->nickname = $nickname; |
113
|
|
|
return $this; |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
public function getNickname() |
117
|
|
|
{ |
118
|
|
|
return strtoupper($this->nickname); |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
public function setComplement($complement) |
122
|
|
|
{ |
123
|
|
|
$this->complement = $complement; |
124
|
|
|
return $this; |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
public function getComplement() |
128
|
|
|
{ |
129
|
|
|
return strtoupper($this->complement); |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
public function setPeople(?People $people = null) |
|
|
|
|
133
|
|
|
{ |
134
|
|
|
$this->people = $people; |
135
|
|
|
return $this; |
136
|
|
|
} |
137
|
|
|
|
138
|
|
|
public function getPeople(): People |
139
|
|
|
{ |
140
|
|
|
return $this->people; |
141
|
|
|
} |
142
|
|
|
|
143
|
|
|
public function setStreet($street) |
144
|
|
|
{ |
145
|
|
|
$this->street = $street; |
146
|
|
|
return $this; |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
public function getStreet() |
150
|
|
|
{ |
151
|
|
|
return $this->street; |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
public function setLatitude($latitude) |
155
|
|
|
{ |
156
|
|
|
$this->latitude = $latitude ?: 0; |
157
|
|
|
return $this; |
158
|
|
|
} |
159
|
|
|
|
160
|
|
|
public function getLatitude() |
161
|
|
|
{ |
162
|
|
|
return $this->latitude; |
163
|
|
|
} |
164
|
|
|
|
165
|
|
|
public function setLongitude($longitude) |
166
|
|
|
{ |
167
|
|
|
$this->longitude = $longitude ?: 0; |
168
|
|
|
return $this; |
169
|
|
|
} |
170
|
|
|
|
171
|
|
|
public function getLongitude() |
172
|
|
|
{ |
173
|
|
|
return $this->longitude; |
174
|
|
|
} |
175
|
|
|
|
176
|
|
|
public function getLocator() |
177
|
|
|
{ |
178
|
|
|
return $this->locator; |
179
|
|
|
} |
180
|
|
|
|
181
|
|
|
public function setLocator($locator) |
182
|
|
|
{ |
183
|
|
|
$this->locator = $locator; |
184
|
|
|
return $this; |
185
|
|
|
} |
186
|
|
|
|
187
|
|
|
public function getOpeningTime() |
188
|
|
|
{ |
189
|
|
|
return $this->opening_time; |
190
|
|
|
} |
191
|
|
|
|
192
|
|
|
public function setOpeningTime($opening_time): self |
193
|
|
|
{ |
194
|
|
|
$this->opening_time = $opening_time; |
195
|
|
|
return $this; |
196
|
|
|
} |
197
|
|
|
|
198
|
|
|
public function getClosingTime() |
199
|
|
|
{ |
200
|
|
|
return $this->closing_time; |
201
|
|
|
} |
202
|
|
|
|
203
|
|
|
public function setClosingTime($closing_time): self |
204
|
|
|
{ |
205
|
|
|
$this->closing_time = $closing_time; |
206
|
|
|
return $this; |
207
|
|
|
} |
208
|
|
|
|
209
|
|
|
public function getSearchFor() |
210
|
|
|
{ |
211
|
|
|
return $this->search_for; |
212
|
|
|
} |
213
|
|
|
|
214
|
|
|
public function setSearchFor(string $search_for = null): self |
215
|
|
|
{ |
216
|
|
|
$this->search_for = $search_for; |
217
|
|
|
return $this; |
218
|
|
|
} |
219
|
|
|
} |
220
|
|
|
|
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