ControleOnline /
api-platform-common
| 1 | <?php |
||
| 2 | |||
| 3 | namespace ControleOnline\Entity; |
||
| 4 | |||
| 5 | use Symfony\Component\Serializer\Attribute\Groups; |
||
|
0 ignored issues
–
show
|
|||
| 6 | |||
| 7 | use ControleOnline\Repository\CepRepository; |
||
| 8 | use Doctrine\Common\Collections\ArrayCollection; |
||
|
0 ignored issues
–
show
The type
Doctrine\Common\Collections\ArrayCollection 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 Loading history...
|
|||
| 9 | use Doctrine\Common\Collections\Collection; |
||
|
0 ignored issues
–
show
The type
Doctrine\Common\Collections\Collection 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 Loading history...
|
|||
| 10 | use ControleOnline\Listener\LogListener; |
||
| 11 | 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 Loading history...
|
|||
| 12 | 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 Loading history...
|
|||
| 13 | use Doctrine\ORM\Mapping\Column; |
||
|
0 ignored issues
–
show
The type
Doctrine\ORM\Mapping\Column 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 Loading history...
|
|||
| 14 | use Doctrine\ORM\Mapping\Entity; |
||
|
0 ignored issues
–
show
The type
Doctrine\ORM\Mapping\Entity 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 Loading history...
|
|||
| 15 | use Doctrine\ORM\Mapping\EntityListeners; |
||
|
0 ignored issues
–
show
The type
Doctrine\ORM\Mapping\EntityListeners 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 Loading history...
|
|||
| 16 | use Doctrine\ORM\Mapping\GeneratedValue; |
||
|
0 ignored issues
–
show
The type
Doctrine\ORM\Mapping\GeneratedValue 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 Loading history...
|
|||
| 17 | use Doctrine\ORM\Mapping\Id; |
||
|
0 ignored issues
–
show
The type
Doctrine\ORM\Mapping\Id 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 Loading history...
|
|||
| 18 | use Doctrine\ORM\Mapping\OneToMany; |
||
|
0 ignored issues
–
show
The type
Doctrine\ORM\Mapping\OneToMany 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 Loading history...
|
|||
| 19 | use Doctrine\ORM\Mapping\Table; |
||
|
0 ignored issues
–
show
The type
Doctrine\ORM\Mapping\Table 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 Loading history...
|
|||
| 20 | use Doctrine\ORM\Mapping\UniqueConstraint; |
||
|
0 ignored issues
–
show
The type
Doctrine\ORM\Mapping\UniqueConstraint 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 Loading history...
|
|||
| 21 | |||
| 22 | #[ApiResource( |
||
| 23 | operations: [new Get(security: 'is_granted(\'ROLE_CLIENT\')')], |
||
| 24 | formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
||
| 25 | normalizationContext: ['groups' => ['cep:read']], |
||
| 26 | denormalizationContext: ['groups' => ['cep:write']] |
||
| 27 | )] |
||
| 28 | #[Table(name: 'cep')] |
||
| 29 | #[UniqueConstraint(name: 'CEP', columns: ['cep'])] |
||
| 30 | #[EntityListeners([LogListener::class])] |
||
| 31 | #[Entity(repositoryClass: CepRepository::class)] |
||
| 32 | class Cep |
||
| 33 | { |
||
| 34 | #[Groups(['people:read', 'order_details:read', 'order:write', 'address:read'])] |
||
| 35 | #[Column(name: 'id', type: 'integer', nullable: false)] |
||
| 36 | #[Id] |
||
| 37 | #[GeneratedValue(strategy: 'IDENTITY')] |
||
| 38 | private int $id = 0; |
||
| 39 | |||
| 40 | #[Groups(['people:read', 'order_details:read', 'order:write', 'address:read'])] |
||
| 41 | #[Column(name: 'cep', type: 'integer', nullable: false)] |
||
| 42 | private int $cep; |
||
| 43 | |||
| 44 | #[OneToMany(targetEntity: Street::class, mappedBy: 'cep')] |
||
| 45 | private Collection $street; |
||
| 46 | |||
| 47 | public function __construct() |
||
| 48 | { |
||
| 49 | $this->street = new ArrayCollection(); |
||
| 50 | } |
||
| 51 | |||
| 52 | public function getId(): int |
||
| 53 | { |
||
| 54 | return $this->id; |
||
| 55 | } |
||
| 56 | |||
| 57 | public function setCep(int $cep): self |
||
| 58 | { |
||
| 59 | $this->cep = $cep; |
||
| 60 | return $this; |
||
| 61 | } |
||
| 62 | |||
| 63 | public function getCep(): string |
||
| 64 | { |
||
| 65 | return str_pad((string) $this->cep, 8, "0", STR_PAD_LEFT); |
||
| 66 | } |
||
| 67 | |||
| 68 | public function addStreet(Street $street): self |
||
| 69 | { |
||
| 70 | if (!$this->street->contains($street)) { |
||
| 71 | $this->street[] = $street; |
||
| 72 | } |
||
| 73 | return $this; |
||
| 74 | } |
||
| 75 | |||
| 76 | public function removeStreet(Street $street): self |
||
| 77 | { |
||
| 78 | $this->street->removeElement($street); |
||
| 79 | return $this; |
||
| 80 | } |
||
| 81 | |||
| 82 | public function getStreet(): Collection |
||
| 83 | { |
||
| 84 | return $this->street; |
||
| 85 | } |
||
| 86 | } |
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