1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace ControleOnline\Entity; |
4
|
|
|
|
5
|
|
|
use ApiPlatform\Metadata\GetCollection; |
|
|
|
|
6
|
|
|
use ApiPlatform\Metadata\Get; |
|
|
|
|
7
|
|
|
use ApiPlatform\Metadata\ApiResource; |
|
|
|
|
8
|
|
|
use ApiPlatform\Metadata\ApiProperty; |
|
|
|
|
9
|
|
|
use ApiPlatform\Metadata\ApiFilter; |
|
|
|
|
10
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
|
|
|
11
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
|
|
|
|
12
|
|
|
use Doctrine\Common\Collections\Collection; |
|
|
|
|
13
|
|
|
use Symfony\Component\Serializer\Annotation\Groups; |
|
|
|
|
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* Street |
17
|
|
|
* |
18
|
|
|
* @ORM\EntityListeners ({App\Listener\LogListener::class}) |
19
|
|
|
* @ORM\Table (name="street", uniqueConstraints={@ORM\UniqueConstraint (name="street_2", columns={"street", "district_id"})}, indexes={@ORM\Index (name="district_id", columns={"district_id"}),@ORM\Index(name="cep", columns={"cep_id"}), @ORM\Index(name="street", columns={"street"})}) |
20
|
|
|
* @ORM\Entity (repositoryClass="ControleOnline\Repository\StreetRepository") |
21
|
|
|
*/ |
22
|
|
|
#[ApiResource( |
23
|
|
|
operations: [ |
24
|
|
|
new Get(security: 'is_granted(\'ROLE_CLIENT\')'), |
25
|
|
|
new GetCollection(security: 'is_granted(\'ROLE_CLIENT\')') |
26
|
|
|
], |
27
|
|
|
formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
28
|
|
|
normalizationContext: ['groups' => ['street_read']], |
29
|
|
|
denormalizationContext: ['groups' => ['street_write']] |
30
|
|
|
)] |
31
|
|
|
class Street |
32
|
|
|
{ |
33
|
|
|
/** |
34
|
|
|
* @var integer |
35
|
|
|
* |
36
|
|
|
* @ORM\Column(name="id", type="integer", nullable=false) |
37
|
|
|
* @ORM\Id |
38
|
|
|
* @ORM\GeneratedValue(strategy="IDENTITY") |
39
|
|
|
*/ |
40
|
|
|
private $id; |
41
|
|
|
/** |
42
|
|
|
* @var string |
43
|
|
|
* |
44
|
|
|
* @ORM\Column(name="street", type="string", length=255, nullable=false) |
45
|
|
|
* @Groups({"people_read", "address_read"}) |
46
|
|
|
*/ |
47
|
|
|
private $street; |
48
|
|
|
/** |
49
|
|
|
* @var District |
50
|
|
|
* |
51
|
|
|
* @ORM\ManyToOne(targetEntity="ControleOnline\Entity\District", inversedBy="street") |
52
|
|
|
* @ORM\JoinColumns({ |
53
|
|
|
* @ORM\JoinColumn(name="district_id", referencedColumnName="id", nullable=false) |
54
|
|
|
* }) |
55
|
|
|
* @Groups({"people_read", "address_read"}) |
56
|
|
|
*/ |
57
|
|
|
private $district; |
58
|
|
|
/** |
59
|
|
|
* @var Cep |
60
|
|
|
* |
61
|
|
|
* @ORM\ManyToOne(targetEntity="ControleOnline\Entity\Cep", inversedBy="street") |
62
|
|
|
* @ORM\JoinColumns({ |
63
|
|
|
* @ORM\JoinColumn(name="cep_id", referencedColumnName="id", nullable=false) |
64
|
|
|
* }) |
65
|
|
|
* @Groups({"people_read", "address_read"}) |
66
|
|
|
*/ |
67
|
|
|
private $cep; |
68
|
|
|
/** |
69
|
|
|
* @var \Doctrine\Common\Collections\Collection |
70
|
|
|
* |
71
|
|
|
* @ORM\OneToMany(targetEntity="ControleOnline\Entity\Address", mappedBy="street") |
72
|
|
|
*/ |
73
|
|
|
private $address; |
74
|
|
|
/** |
75
|
|
|
* @var boolean |
76
|
|
|
* |
77
|
|
|
* @ORM\Column(name="confirmed", type="boolean", nullable=true) |
78
|
|
|
*/ |
79
|
|
|
private $confirmed; |
80
|
|
|
/** |
81
|
|
|
* Constructor |
82
|
|
|
*/ |
83
|
|
|
public function __construct() |
84
|
|
|
{ |
85
|
|
|
$this->address = new ArrayCollection(); |
86
|
|
|
} |
87
|
|
|
/** |
88
|
|
|
* Get id |
89
|
|
|
* |
90
|
|
|
* @return integer |
91
|
|
|
*/ |
92
|
|
|
public function getId() |
93
|
|
|
{ |
94
|
|
|
return $this->id; |
95
|
|
|
} |
96
|
|
|
/** |
97
|
|
|
* Set street |
98
|
|
|
* |
99
|
|
|
* @param string $street |
100
|
|
|
* @return Street |
101
|
|
|
*/ |
102
|
|
|
public function setStreet($street) |
103
|
|
|
{ |
104
|
|
|
$this->street = $street; |
105
|
|
|
return $this; |
106
|
|
|
} |
107
|
|
|
/** |
108
|
|
|
* Get street |
109
|
|
|
* |
110
|
|
|
* @return string |
111
|
|
|
*/ |
112
|
|
|
public function getStreet() |
113
|
|
|
{ |
114
|
|
|
return strtoupper($this->street); |
115
|
|
|
} |
116
|
|
|
/** |
117
|
|
|
* Set district |
118
|
|
|
* |
119
|
|
|
* @param District $district |
120
|
|
|
* @return District |
121
|
|
|
*/ |
122
|
|
|
public function setDistrict(District $district = null) |
123
|
|
|
{ |
124
|
|
|
$this->district = $district; |
125
|
|
|
return $this; |
|
|
|
|
126
|
|
|
} |
127
|
|
|
/** |
128
|
|
|
* Get district |
129
|
|
|
* |
130
|
|
|
* @return District |
131
|
|
|
*/ |
132
|
|
|
public function getDistrict() |
133
|
|
|
{ |
134
|
|
|
return $this->district; |
135
|
|
|
} |
136
|
|
|
/** |
137
|
|
|
* Set cep |
138
|
|
|
* |
139
|
|
|
* @param Cep $cep |
140
|
|
|
* @return Cep |
141
|
|
|
*/ |
142
|
|
|
public function setCep(Cep $cep = null) |
143
|
|
|
{ |
144
|
|
|
$this->cep = $cep; |
145
|
|
|
return $this; |
|
|
|
|
146
|
|
|
} |
147
|
|
|
/** |
148
|
|
|
* Get cep |
149
|
|
|
* |
150
|
|
|
* @return Cep |
151
|
|
|
*/ |
152
|
|
|
public function getCep() |
153
|
|
|
{ |
154
|
|
|
return $this->cep; |
155
|
|
|
} |
156
|
|
|
/** |
157
|
|
|
* Add address |
158
|
|
|
* |
159
|
|
|
* @param Address $address |
160
|
|
|
* @return Street |
161
|
|
|
*/ |
162
|
|
|
public function addAddress(Address $address) |
163
|
|
|
{ |
164
|
|
|
$this->address[] = $address; |
165
|
|
|
return $this; |
166
|
|
|
} |
167
|
|
|
/** |
168
|
|
|
* Remove address |
169
|
|
|
* |
170
|
|
|
* @param Address $address |
171
|
|
|
*/ |
172
|
|
|
public function removeAddress(Address $address) |
173
|
|
|
{ |
174
|
|
|
$this->address->removeElement($address); |
175
|
|
|
} |
176
|
|
|
/** |
177
|
|
|
* Get address |
178
|
|
|
* |
179
|
|
|
* @return \Doctrine\Common\Collections\Collection |
180
|
|
|
*/ |
181
|
|
|
public function getAddress() |
182
|
|
|
{ |
183
|
|
|
return $this->address; |
184
|
|
|
} |
185
|
|
|
/** |
186
|
|
|
* Set confirmed |
187
|
|
|
* |
188
|
|
|
* @param boolean $confirmed |
189
|
|
|
* @return Street |
190
|
|
|
*/ |
191
|
|
|
public function setConfirmed($confirmed) |
192
|
|
|
{ |
193
|
|
|
$this->confirmed = $confirmed; |
194
|
|
|
return $this; |
195
|
|
|
} |
196
|
|
|
/** |
197
|
|
|
* Get confirmed |
198
|
|
|
* |
199
|
|
|
* @return boolean |
200
|
|
|
*/ |
201
|
|
|
public function getConfirmed() |
202
|
|
|
{ |
203
|
|
|
return $this->confirmed; |
204
|
|
|
} |
205
|
|
|
} |
206
|
|
|
|
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