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\FileRepository; |
||
| 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 ControleOnline\Controller\GetFileDataAction; |
||
| 17 | use ControleOnline\Controller\FileUploadController; |
||
| 18 | use ControleOnline\Controller\FileConvertController; |
||
| 19 | 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...
|
|||
| 20 | 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...
|
|||
| 21 | 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...
|
|||
| 22 | 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...
|
|||
| 23 | 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...
|
|||
| 24 | use Doctrine\ORM\Mapping\JoinColumn; |
||
|
0 ignored issues
–
show
The type
Doctrine\ORM\Mapping\JoinColumn 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...
|
|||
| 25 | use Doctrine\ORM\Mapping\ManyToOne; |
||
|
0 ignored issues
–
show
The type
Doctrine\ORM\Mapping\ManyToOne 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...
|
|||
| 26 | 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...
|
|||
| 27 | 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...
|
|||
| 28 | 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...
|
|||
| 29 | use Symfony\Component\Validator\Constraints\NotBlank; |
||
|
0 ignored issues
–
show
The type
Symfony\Component\Validator\Constraints\NotBlank 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...
|
|||
| 30 | |||
| 31 | #[ApiResource( |
||
| 32 | operations: [ |
||
| 33 | new Get( |
||
| 34 | security: 'is_granted(\'ROLE_CLIENT\')', |
||
| 35 | normalizationContext: ['groups' => ['file_item:read']], |
||
| 36 | ), |
||
| 37 | new Get( |
||
| 38 | security: 'is_granted(\'PUBLIC_ACCESS\')', |
||
| 39 | uriTemplate: '/files/{id}/download', |
||
| 40 | controller: GetFileDataAction::class |
||
| 41 | ), |
||
| 42 | new Delete(security: 'is_granted(\'ROLE_CLIENT\')'), |
||
| 43 | new Post( |
||
| 44 | security: 'is_granted(\'ROLE_CLIENT\')', |
||
| 45 | uriTemplate: '/files/upload', |
||
| 46 | controller: FileUploadController::class, |
||
| 47 | deserialize: false |
||
| 48 | ), |
||
| 49 | new GetCollection(security: 'is_granted(\'ROLE_CLIENT\')'), |
||
| 50 | new Post(security: 'is_granted(\'ROLE_CLIENT\')'), |
||
| 51 | new Put( |
||
| 52 | security: 'is_granted(\'ROLE_ADMIN\') or (is_granted(\'ROLE_CLIENT\'))', |
||
| 53 | validationContext: ['groups' => ['file:write']], |
||
| 54 | denormalizationContext: ['groups' => ['file:write']] |
||
| 55 | ), |
||
| 56 | new Post( |
||
| 57 | security: 'is_granted(\'ROLE_ADMIN\') or (is_granted(\'ROLE_CLIENT\'))', |
||
| 58 | uriTemplate: '/files/{id}/convert', |
||
| 59 | controller: FileConvertController::class, |
||
| 60 | deserialize: false |
||
| 61 | ), |
||
| 62 | ], |
||
| 63 | normalizationContext: ['groups' => ['file:read']], |
||
| 64 | denormalizationContext: ['groups' => ['file:write']] |
||
| 65 | )] |
||
| 66 | #[Table(name: 'files')] |
||
| 67 | #[UniqueConstraint(name: 'url', columns: ['url'])] |
||
| 68 | #[UniqueConstraint(name: 'path', columns: ['path'])] |
||
| 69 | #[EntityListeners([LogListener::class])] |
||
| 70 | #[Entity(repositoryClass: FileRepository::class)] |
||
| 71 | class File |
||
| 72 | { |
||
| 73 | #[Groups(['file:read', 'spool:read', 'order_details:read', 'order:write', 'category:read', 'product_category:read', 'order_product:read', 'product_file:read', 'product:read', 'spool_item:read', 'file_item:read', 'contract:read', 'model:read', 'people:read'])] |
||
| 74 | #[Column(type: 'integer', nullable: false)] |
||
| 75 | #[Id] |
||
| 76 | #[GeneratedValue(strategy: 'IDENTITY')] |
||
| 77 | private int $id = 0; |
||
| 78 | |||
| 79 | #[Groups(['file:read', 'spool:read', 'order_details:read', 'order:write', 'category:read', 'product_category:read', 'order_product:read', 'product_file:read', 'product:read', 'spool_item:read', 'file_item:read', 'file:write', 'contract:read', 'model:read', 'people:read'])] |
||
| 80 | #[NotBlank] |
||
| 81 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['fileType' => 'exact'])] |
||
| 82 | #[Column(type: 'string', length: 255, nullable: false)] |
||
| 83 | private string $fileType; |
||
| 84 | |||
| 85 | #[Groups(['file:read', 'spool:read', 'order_details:read', 'order:write', 'category:read', 'product_category:read', 'order_product:read', 'product_file:read', 'product:read', 'spool_item:read', 'file_item:read', 'file:write', 'contract:read', 'model:read', 'people:read'])] |
||
| 86 | #[NotBlank] |
||
| 87 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['fileName' => 'exact'])] |
||
| 88 | #[Column(type: 'string', length: 255, nullable: false)] |
||
| 89 | private string $fileName; |
||
| 90 | |||
| 91 | #[Groups(['file:read', 'spool:read', 'order_details:read', 'order:write', 'category:read', 'product_category:read', 'order_product:read', 'product_file:read', 'product:read', 'spool_item:read', 'file_item:read', 'file:write', 'contract:read', 'model:read', 'people:read'])] |
||
| 92 | #[NotBlank] |
||
| 93 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['context' => 'exact'])] |
||
| 94 | #[Column(type: 'string', length: 255, nullable: false)] |
||
| 95 | private string $context; |
||
| 96 | |||
| 97 | #[Groups(['file:read', 'spool:read', 'order_details:read', 'order:write', 'category:read', 'product_category:read', 'order_product:read', 'product_file:read', 'product:read', 'spool_item:read', 'file_item:read', 'file:write', 'contract:read', 'model:read', 'people:read'])] |
||
| 98 | #[NotBlank] |
||
| 99 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['extension' => 'exact'])] |
||
| 100 | #[Column(type: 'string', length: 255, nullable: false)] |
||
| 101 | private string $extension; |
||
| 102 | |||
| 103 | #[Groups(['spool_item:read', 'file_item:read', 'file:write'])] |
||
| 104 | #[Column(type: 'string', length: 255, nullable: false)] |
||
| 105 | private string $content; |
||
| 106 | |||
| 107 | #[Groups(['spool_item:read', 'file_item:read', 'file:write', 'file:read'])] |
||
| 108 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['people' => 'exact'])] |
||
| 109 | #[JoinColumn(name: 'people_id', referencedColumnName: 'id', nullable: true)] |
||
| 110 | #[ManyToOne(targetEntity: People::class)] |
||
| 111 | private ?People $people = null; |
||
|
0 ignored issues
–
show
The type
ControleOnline\Entity\People 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...
|
|||
| 112 | |||
| 113 | public function __construct() |
||
| 114 | { |
||
| 115 | // Constructor remains empty after removing incorrect collection initialization |
||
| 116 | } |
||
| 117 | |||
| 118 | public function getId(): int |
||
| 119 | { |
||
| 120 | return $this->id; |
||
| 121 | } |
||
| 122 | |||
| 123 | public function getFileType(): string |
||
| 124 | { |
||
| 125 | return $this->fileType; |
||
| 126 | } |
||
| 127 | |||
| 128 | public function setFileType(string $fileType): self |
||
| 129 | { |
||
| 130 | $this->fileType = $fileType; |
||
| 131 | return $this; |
||
| 132 | } |
||
| 133 | |||
| 134 | public function getContent(): string |
||
| 135 | { |
||
| 136 | return $this->content; |
||
| 137 | } |
||
| 138 | |||
| 139 | public function setContent(string $content): self |
||
| 140 | { |
||
| 141 | $this->content = $content; |
||
| 142 | return $this; |
||
| 143 | } |
||
| 144 | |||
| 145 | public function getPeople(): ?People |
||
| 146 | { |
||
| 147 | return $this->people; |
||
| 148 | } |
||
| 149 | |||
| 150 | public function setPeople(?People $people): self |
||
| 151 | { |
||
| 152 | $this->people = $people; |
||
| 153 | return $this; |
||
| 154 | } |
||
| 155 | |||
| 156 | public function getExtension(): string |
||
| 157 | { |
||
| 158 | return $this->extension; |
||
| 159 | } |
||
| 160 | |||
| 161 | public function setExtension(string $extension): self |
||
| 162 | { |
||
| 163 | $this->extension = $extension; |
||
| 164 | return $this; |
||
| 165 | } |
||
| 166 | |||
| 167 | public function getFileName(): string |
||
| 168 | { |
||
| 169 | return $this->fileName; |
||
| 170 | } |
||
| 171 | |||
| 172 | public function setFileName(string $fileName): self |
||
| 173 | { |
||
| 174 | $this->fileName = $fileName; |
||
| 175 | return $this; |
||
| 176 | } |
||
| 177 | |||
| 178 | public function getContext(): string |
||
| 179 | { |
||
| 180 | return $this->context; |
||
| 181 | } |
||
| 182 | |||
| 183 | public function setContext(string $context): self |
||
| 184 | { |
||
| 185 | $this->context = $context; |
||
| 186 | return $this; |
||
| 187 | } |
||
| 188 | } |
||
| 189 |
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