ControleOnline /
api-platform-people
| 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 Loading history...
|
|||
| 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 Loading history...
|
|||
| 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 Loading history...
|
|||
| 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 Loading history...
|
|||
| 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 Loading history...
|
|||
| 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 Loading history...
|
|||
| 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 Loading history...
|
|||
| 14 | use ApiPlatform\Metadata\Delete; |
||
|
0 ignored issues
–
show
The type
ApiPlatform\Metadata\Delete 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 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 Loading history...
|
|||
| 16 | use ControleOnline\Repository\DocumentRepository; |
||
| 17 | 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 Loading history...
|
|||
| 18 | |||
| 19 | #[ApiResource( |
||
| 20 | operations: [ |
||
| 21 | new Get(security: "is_granted('ROLE_CLIENT')"), |
||
| 22 | new GetCollection(security: "is_granted('ROLE_CLIENT')"), |
||
| 23 | new Put( |
||
| 24 | security: "is_granted('ROLE_ADMIN') or is_granted('ROLE_CLIENT')", |
||
| 25 | validationContext: ['groups' => ['document:read']], |
||
| 26 | denormalizationContext: ['groups' => ['document:write']] |
||
| 27 | ), |
||
| 28 | new Post(securityPostDenormalize: "is_granted('ROLE_CLIENT')"), |
||
| 29 | new Delete(security: "is_granted('ROLE_CLIENT')") |
||
| 30 | ], |
||
| 31 | formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
||
| 32 | normalizationContext: ['groups' => ['document:read']], |
||
| 33 | denormalizationContext: ['groups' => ['document:write']] |
||
| 34 | )] |
||
| 35 | |||
| 36 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['people' => 'exact'])] |
||
| 37 | #[ORM\Table(name: 'document')] |
||
| 38 | #[ORM\Index(name: 'type_2', columns: ['document_type_id'])] |
||
| 39 | #[ORM\Index(name: 'file_id', columns: ['file_id'])] |
||
| 40 | #[ORM\Index(name: 'type', columns: ['people_id', 'document_type_id'])] |
||
| 41 | #[ORM\UniqueConstraint(name: 'doc', columns: ['document', 'document_type_id'])] |
||
| 42 | |||
| 43 | #[ORM\Entity(repositoryClass: DocumentRepository::class)] |
||
| 44 | class Document |
||
| 45 | { |
||
| 46 | #[ORM\Column(name: 'id', type: 'integer', nullable: false)] |
||
| 47 | #[ORM\Id] |
||
| 48 | #[ORM\GeneratedValue(strategy: 'IDENTITY')] |
||
| 49 | private int $id = 0; |
||
| 50 | |||
| 51 | #[ORM\Column(name: 'document', type: 'bigint', nullable: false)] |
||
| 52 | #[Groups(['people:read', 'document:read', 'carrier:read', 'provider:read', 'document:write'])] |
||
| 53 | private int $document; |
||
| 54 | |||
| 55 | #[ORM\JoinColumn(name: 'people_id', referencedColumnName: 'id', nullable: false)] |
||
| 56 | #[ORM\ManyToOne(targetEntity: People::class, inversedBy: 'document')] |
||
| 57 | #[Groups(['document:read', 'document:write'])] |
||
| 58 | private People $people; |
||
| 59 | |||
| 60 | #[ORM\JoinColumn(name: 'file_id', referencedColumnName: 'id', nullable: true)] |
||
| 61 | #[ORM\ManyToOne(targetEntity: File::class)] |
||
| 62 | #[Groups(['document:read', 'document:write'])] |
||
| 63 | private ?File $file = null; |
||
|
0 ignored issues
–
show
The type
ControleOnline\Entity\File 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...
|
|||
| 64 | |||
| 65 | #[ORM\JoinColumn(name: 'document_type_id', referencedColumnName: 'id', nullable: false)] |
||
| 66 | #[ORM\ManyToOne(targetEntity: DocumentType::class)] |
||
| 67 | #[Groups(['people:read', 'document:read', 'carrier:read', 'document:write'])] |
||
| 68 | private DocumentType $documentType; |
||
| 69 | |||
| 70 | public function getId(): int |
||
| 71 | { |
||
| 72 | return $this->id; |
||
| 73 | } |
||
| 74 | |||
| 75 | public function setDocument(int $document): self |
||
| 76 | { |
||
| 77 | $this->document = $document; |
||
| 78 | return $this; |
||
| 79 | } |
||
| 80 | |||
| 81 | public function getDocument(): string |
||
| 82 | { |
||
| 83 | $document = (string) $this->document; |
||
| 84 | if ($this->getDocumentType()->getDocumentType() === 'CPF') { |
||
| 85 | return str_pad($document, 11, '0', STR_PAD_LEFT); |
||
| 86 | } |
||
| 87 | if ($this->getDocumentType()->getDocumentType() === 'CNPJ') { |
||
| 88 | return str_pad($document, 14, '0', STR_PAD_LEFT); |
||
| 89 | } |
||
| 90 | return $document; |
||
| 91 | } |
||
| 92 | |||
| 93 | public function setFile(?File $file): self |
||
| 94 | { |
||
| 95 | $this->file = $file; |
||
| 96 | return $this; |
||
| 97 | } |
||
| 98 | |||
| 99 | public function getFile(): ?File |
||
| 100 | { |
||
| 101 | return $this->file; |
||
| 102 | } |
||
| 103 | |||
| 104 | public function setPeople(People $people): self |
||
| 105 | { |
||
| 106 | $this->people = $people; |
||
| 107 | return $this; |
||
| 108 | } |
||
| 109 | |||
| 110 | public function getPeople(): People |
||
| 111 | { |
||
| 112 | return $this->people; |
||
| 113 | } |
||
| 114 | |||
| 115 | public function setDocumentType(DocumentType $documentType): self |
||
| 116 | { |
||
| 117 | $this->documentType = $documentType; |
||
| 118 | return $this; |
||
| 119 | } |
||
| 120 | |||
| 121 | public function getDocumentType(): DocumentType |
||
| 122 | { |
||
| 123 | return $this->documentType; |
||
| 124 | } |
||
| 125 | } |
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