1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace ControleOnline\Entity; |
4
|
|
|
|
5
|
|
|
use ApiPlatform\Metadata\Get; |
|
|
|
|
6
|
|
|
use ApiPlatform\Metadata\ApiResource; |
|
|
|
|
7
|
|
|
use ApiPlatform\Metadata\ApiProperty; |
|
|
|
|
8
|
|
|
use ApiPlatform\Metadata\ApiFilter; |
|
|
|
|
9
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
|
|
|
10
|
|
|
use DoctrineExtensions\Query\Mysql\Lpad; |
|
|
|
|
11
|
|
|
use Symfony\Component\Serializer\Annotation\Groups; |
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* Cep |
14
|
|
|
* |
15
|
|
|
* @ORM\EntityListeners ({App\Listener\LogListener::class}) |
16
|
|
|
* @ORM\Table (name="cep", uniqueConstraints={@ORM\UniqueConstraint (name="CEP", columns={"cep"})}) |
17
|
|
|
* @ORM\Entity (repositoryClass="ControleOnline\Repository\CepRepository") |
18
|
|
|
*/ |
19
|
|
|
#[ApiResource(operations: [new Get(security: 'is_granted(\'ROLE_CLIENT\')')], formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], normalizationContext: ['groups' => ['cep_read']], denormalizationContext: ['groups' => ['cep_write']])] |
20
|
|
|
class Cep |
21
|
|
|
{ |
22
|
|
|
/** |
23
|
|
|
* @var integer |
24
|
|
|
* |
25
|
|
|
* @ORM\Column(name="id", type="integer", nullable=false) |
26
|
|
|
* @ORM\Id |
27
|
|
|
* @ORM\GeneratedValue(strategy="IDENTITY") |
28
|
|
|
*/ |
29
|
|
|
private $id; |
30
|
|
|
/** |
31
|
|
|
* @var integer |
32
|
|
|
* |
33
|
|
|
* @ORM\Column(name="cep", type="integer", nullable=false) |
34
|
|
|
* @Groups({"people_read", "address_read"}) |
35
|
|
|
*/ |
36
|
|
|
private $cep; |
37
|
|
|
/** |
38
|
|
|
* @var \Doctrine\Common\Collections\Collection |
|
|
|
|
39
|
|
|
* |
40
|
|
|
* @ORM\OneToMany(targetEntity="ControleOnline\Entity\Street", mappedBy="cep") |
41
|
|
|
*/ |
42
|
|
|
private $street; |
43
|
|
|
/** |
44
|
|
|
* Constructor |
45
|
|
|
*/ |
46
|
|
|
public function __construct() |
47
|
|
|
{ |
48
|
|
|
$this->street = new \Doctrine\Common\Collections\ArrayCollection(); |
|
|
|
|
49
|
|
|
} |
50
|
|
|
/** |
51
|
|
|
* Get id |
52
|
|
|
* |
53
|
|
|
* @return integer |
54
|
|
|
*/ |
55
|
|
|
public function getId() |
56
|
|
|
{ |
57
|
|
|
return $this->id; |
58
|
|
|
} |
59
|
|
|
/** |
60
|
|
|
* Set cep |
61
|
|
|
* |
62
|
|
|
* @param integer $cep |
63
|
|
|
* @return Cep |
64
|
|
|
*/ |
65
|
|
|
public function setCep($cep) |
66
|
|
|
{ |
67
|
|
|
$this->cep = $cep; |
68
|
|
|
return $this; |
69
|
|
|
} |
70
|
|
|
/** |
71
|
|
|
* Get cep |
72
|
|
|
* |
73
|
|
|
* @return integer |
74
|
|
|
*/ |
75
|
|
|
public function getCep() |
76
|
|
|
{ |
77
|
|
|
return STR_PAD($this->cep, 8, "0", STR_PAD_LEFT); |
|
|
|
|
78
|
|
|
} |
79
|
|
|
/** |
80
|
|
|
* Add street |
81
|
|
|
* |
82
|
|
|
* @param \ControleOnline\Entity\Street $street |
83
|
|
|
* @return Cep |
84
|
|
|
*/ |
85
|
|
|
public function addStreet(\ControleOnline\Entity\Street $street) |
86
|
|
|
{ |
87
|
|
|
$this->street[] = $street; |
88
|
|
|
return $this; |
89
|
|
|
} |
90
|
|
|
/** |
91
|
|
|
* Remove street |
92
|
|
|
* |
93
|
|
|
* @param \ControleOnline\Entity\Street $street |
94
|
|
|
*/ |
95
|
|
|
public function removeStreet(\ControleOnline\Entity\Street $street) |
96
|
|
|
{ |
97
|
|
|
$this->street->removeElement($street); |
98
|
|
|
} |
99
|
|
|
/** |
100
|
|
|
* Get street |
101
|
|
|
* |
102
|
|
|
* @return \Doctrine\Common\Collections\Collection |
103
|
|
|
*/ |
104
|
|
|
public function getStreet() |
105
|
|
|
{ |
106
|
|
|
return $this->street; |
107
|
|
|
} |
108
|
|
|
} |
109
|
|
|
|
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