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\ExtraFieldsRepository; |
||
| 8 | use ControleOnline\Listener\LogListener; |
||
| 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\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...
|
|||
| 11 | 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...
|
|||
| 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 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...
|
|||
| 14 | 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...
|
|||
| 15 | 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...
|
|||
| 16 | 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...
|
|||
| 17 | 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...
|
|||
| 18 | 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...
|
|||
| 19 | 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...
|
|||
| 20 | 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...
|
|||
| 21 | 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...
|
|||
| 22 | 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...
|
|||
| 23 | |||
| 24 | #[ApiResource( |
||
| 25 | operations: [ |
||
| 26 | new Get(security: 'is_granted(\'ROLE_CLIENT\')'), |
||
| 27 | new GetCollection(security: 'is_granted(\'ROLE_CLIENT\')'), |
||
| 28 | new Put( |
||
| 29 | security: 'is_granted(\'ROLE_ADMIN\') or (is_granted(\'ROLE_CLIENT\'))', |
||
| 30 | validationContext: ['groups' => ['extra_fields:write']], |
||
| 31 | denormalizationContext: ['groups' => ['extra_fields:write']] |
||
| 32 | ), |
||
| 33 | new Delete(security: 'is_granted(\'ROLE_CLIENT\')'), |
||
| 34 | new Post(securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')'), |
||
| 35 | ], |
||
| 36 | formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
||
| 37 | normalizationContext: ['groups' => ['extra_fields:read']], |
||
| 38 | denormalizationContext: ['groups' => ['extra_fields:write']] |
||
| 39 | )] |
||
| 40 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['context' => 'exact', 'type' => 'exact'])] // Changed 'field_type' to 'type' based on property name |
||
| 41 | #[Table(name: 'extra_fields')] |
||
| 42 | #[EntityListeners([LogListener::class])] |
||
| 43 | #[Entity(repositoryClass: ExtraFieldsRepository::class)] |
||
| 44 | class ExtraFields |
||
| 45 | { |
||
| 46 | #[Groups(['extra_fields:read', 'extra_data:read'])] |
||
| 47 | #[Column(name: 'id', type: 'integer', nullable: false)] |
||
| 48 | #[Id] |
||
| 49 | #[GeneratedValue(strategy: 'IDENTITY')] |
||
| 50 | private int $id = 0; |
||
| 51 | |||
| 52 | #[Groups(['extra_fields:read', 'extra_fields:write', 'extra_data:read'])] |
||
| 53 | #[Column(name: 'field_name', type: 'string', length: 255, nullable: false)] |
||
| 54 | private string $name; |
||
| 55 | |||
| 56 | #[Groups(['extra_fields:read', 'extra_fields:write', 'extra_data:read'])] |
||
| 57 | #[Column(name: 'field_type', type: 'string', length: 255, nullable: false)] |
||
| 58 | private string $type; |
||
| 59 | |||
| 60 | #[Groups(['extra_fields:read', 'extra_fields:write', 'extra_data:read'])] |
||
| 61 | #[Column(name: 'context', type: 'string', length: 255, nullable: false)] |
||
| 62 | private string $context; |
||
| 63 | |||
| 64 | #[Groups(['extra_fields:read', 'extra_fields:write', 'extra_data:read'])] |
||
| 65 | #[Column(name: 'required', type: 'boolean', nullable: true)] |
||
| 66 | private ?bool $required = null; |
||
| 67 | |||
| 68 | #[Groups(['extra_fields:read', 'extra_fields:write', 'extra_data:read'])] |
||
| 69 | #[Column(name: 'field_configs', type: 'string', nullable: true)] // Consider 'json' type if applicable |
||
| 70 | private ?string $configs = null; |
||
| 71 | |||
| 72 | public function getId(): int |
||
| 73 | { |
||
| 74 | return $this->id; |
||
| 75 | } |
||
| 76 | |||
| 77 | public function getName(): string |
||
| 78 | { |
||
| 79 | return $this->name; |
||
| 80 | } |
||
| 81 | |||
| 82 | public function setName(string $name): self |
||
| 83 | { |
||
| 84 | $this->name = $name; |
||
| 85 | return $this; |
||
| 86 | } |
||
| 87 | |||
| 88 | public function getType(): string |
||
| 89 | { |
||
| 90 | return $this->type; |
||
| 91 | } |
||
| 92 | |||
| 93 | public function setType(string $type): self |
||
| 94 | { |
||
| 95 | $this->type = $type; |
||
| 96 | return $this; |
||
| 97 | } |
||
| 98 | |||
| 99 | public function getContext(): string |
||
| 100 | { |
||
| 101 | return $this->context; |
||
| 102 | } |
||
| 103 | |||
| 104 | public function setContext(string $context): self |
||
| 105 | { |
||
| 106 | $this->context = $context; |
||
| 107 | return $this; |
||
| 108 | } |
||
| 109 | |||
| 110 | public function getRequired(): ?bool |
||
| 111 | { |
||
| 112 | return $this->required; |
||
| 113 | } |
||
| 114 | |||
| 115 | public function setRequired(?bool $required): self |
||
| 116 | { |
||
| 117 | $this->required = $required; |
||
| 118 | return $this; |
||
| 119 | } |
||
| 120 | |||
| 121 | public function getConfigs(): ?string |
||
| 122 | { |
||
| 123 | return $this->configs; |
||
| 124 | } |
||
| 125 | |||
| 126 | public function setConfigs(?string $configs): self |
||
| 127 | { |
||
| 128 | $this->configs = $configs; |
||
| 129 | return $this; |
||
| 130 | } |
||
| 131 | } |
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