1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace ControleOnline\Entity; |
4
|
|
|
|
5
|
|
|
use Symfony\Component\Serializer\Attribute\Groups; |
|
|
|
|
6
|
|
|
|
7
|
|
|
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter; |
|
|
|
|
8
|
|
|
use ApiPlatform\Metadata\ApiFilter; |
|
|
|
|
9
|
|
|
use ApiPlatform\Metadata\ApiResource; |
|
|
|
|
10
|
|
|
use ApiPlatform\Metadata\Delete; |
|
|
|
|
11
|
|
|
use ApiPlatform\Metadata\Get; |
|
|
|
|
12
|
|
|
use ApiPlatform\Metadata\GetCollection; |
|
|
|
|
13
|
|
|
use ApiPlatform\Metadata\Post; |
|
|
|
|
14
|
|
|
use ApiPlatform\Metadata\Put; |
|
|
|
|
15
|
|
|
use ControleOnline\Listener\LogListener; |
16
|
|
|
use ControleOnline\Repository\CategoryFileRepository; |
17
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
|
|
|
18
|
|
|
|
19
|
|
|
#[ApiResource( |
20
|
|
|
operations: [ |
21
|
|
|
new Get(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')'), |
22
|
|
|
new Put( |
23
|
|
|
security: 'is_granted(\'ROLE_CLIENT\')', |
24
|
|
|
denormalizationContext: ['groups' => ['category_file:write']] |
25
|
|
|
), |
26
|
|
|
new Delete(security: 'is_granted(\'ROLE_CLIENT\')'), |
27
|
|
|
new Post(securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')'), |
28
|
|
|
new GetCollection(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')') |
29
|
|
|
], |
30
|
|
|
formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
31
|
|
|
normalizationContext: ['groups' => ['category_file:read']], |
32
|
|
|
denormalizationContext: ['groups' => ['category_file:write']] |
33
|
|
|
)] |
34
|
|
|
#[ORM\Table(name: 'category_file')] |
35
|
|
|
#[ORM\Index(name: 'file_id', columns: ['file_id'])] |
36
|
|
|
#[ORM\Index(name: 'IDX_CDFC73564584665B', columns: ['category_id'])] |
37
|
|
|
#[ORM\UniqueConstraint(name: 'category_id', columns: ['category_id', 'file_id'])] |
38
|
|
|
#[ORM\Entity(repositoryClass: CategoryFileRepository::class)] |
39
|
|
|
class CategoryFile |
40
|
|
|
{ |
41
|
|
|
#[ORM\Column(name: 'id', type: 'integer', nullable: false)] |
42
|
|
|
#[ORM\Id] |
43
|
|
|
#[ORM\GeneratedValue(strategy: 'IDENTITY')] |
44
|
|
|
#[Groups(['category:read', 'category_file:read'])] |
45
|
|
|
private $id; |
46
|
|
|
|
47
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['file' => 'exact', 'file.fileType' => 'exact'])] |
48
|
|
|
#[ORM\JoinColumn(name: 'file_id', referencedColumnName: 'id')] |
49
|
|
|
#[ORM\ManyToOne(targetEntity: File::class)] |
50
|
|
|
#[Groups(['category:read', 'category_file:read', 'category_file:write'])] |
51
|
|
|
private $file; |
52
|
|
|
|
53
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['category' => 'exact'])] |
54
|
|
|
#[ORM\JoinColumn(name: 'category_id', referencedColumnName: 'id')] |
55
|
|
|
#[ORM\ManyToOne(targetEntity: Category::class)] |
56
|
|
|
#[Groups(['category_file:read', 'category_file:write'])] |
57
|
|
|
private $category; |
58
|
|
|
|
59
|
|
|
public function getId() |
60
|
|
|
{ |
61
|
|
|
return $this->id; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
public function getFile(): File |
65
|
|
|
{ |
66
|
|
|
return $this->file; |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
public function setFile(File $file): self |
70
|
|
|
{ |
71
|
|
|
$this->file = $file; |
72
|
|
|
return $this; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
public function getCategory(): Category |
76
|
|
|
{ |
77
|
|
|
return $this->category; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
public function setCategory(Category $category): self |
81
|
|
|
{ |
82
|
|
|
$this->category = $category; |
83
|
|
|
return $this; |
84
|
|
|
} |
85
|
|
|
} |
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