1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace ControleOnline\Entity; |
4
|
|
|
|
5
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
|
|
|
6
|
|
|
use Symfony\Component\Serializer\Annotation\Groups; |
|
|
|
|
7
|
|
|
use ApiPlatform\Metadata\GetCollection; |
|
|
|
|
8
|
|
|
use ApiPlatform\Metadata\Post; |
|
|
|
|
9
|
|
|
use ApiPlatform\Metadata\Delete; |
|
|
|
|
10
|
|
|
use ApiPlatform\Metadata\Put; |
|
|
|
|
11
|
|
|
use ApiPlatform\Metadata\Get; |
|
|
|
|
12
|
|
|
use ApiPlatform\Metadata\ApiResource; |
|
|
|
|
13
|
|
|
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter; |
|
|
|
|
14
|
|
|
use ApiPlatform\Metadata\ApiFilter; |
|
|
|
|
15
|
|
|
|
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* CategoryFile |
19
|
|
|
* |
20
|
|
|
* @ORM\Table(name="category_file", uniqueConstraints={@ORM\UniqueConstraint(name="category_id", columns={"category_id", "file_id"})}, indexes={@ORM\Index(name="file_id", columns={"file_id"}), @ORM\Index(name="IDX_CDFC73564584665B", columns={"category_id"})}) |
21
|
|
|
* @ORM\Entity(repositoryClass="ControleOnline\Repository\CategoryFileRepository") |
22
|
|
|
*/ |
23
|
|
|
|
24
|
|
|
#[ApiResource( |
25
|
|
|
operations: [ |
26
|
|
|
new Get(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')'), |
27
|
|
|
new Put( |
28
|
|
|
security: 'is_granted(\'ROLE_CLIENT\')', |
29
|
|
|
denormalizationContext: ['groups' => ['category_file:write']] |
30
|
|
|
), |
31
|
|
|
new Delete(security: 'is_granted(\'ROLE_CLIENT\')'), |
32
|
|
|
new Post(securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')'), |
33
|
|
|
new GetCollection(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')') |
34
|
|
|
], |
35
|
|
|
formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
36
|
|
|
normalizationContext: ['groups' => ['category_file:read']], |
37
|
|
|
denormalizationContext: ['groups' => ['category_file:write']] |
38
|
|
|
)] |
39
|
|
|
class CategoryFile |
40
|
|
|
{ |
41
|
|
|
/** |
42
|
|
|
* @var int |
43
|
|
|
* |
44
|
|
|
* @ORM\Column(name="id", type="integer", nullable=false) |
45
|
|
|
* @ORM\Id |
46
|
|
|
* @ORM\GeneratedValue(strategy="IDENTITY") |
47
|
|
|
* @Groups({"category:read","category_file:read"}) |
48
|
|
|
*/ |
49
|
|
|
private $id; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @var ControleOnline\Entity\File |
|
|
|
|
53
|
|
|
* |
54
|
|
|
* @ORM\ManyToOne(targetEntity="ControleOnline\Entity\File") |
55
|
|
|
* @ORM\JoinColumns({ |
56
|
|
|
* @ORM\JoinColumn(name="file_id", referencedColumnName="id") |
57
|
|
|
* }) |
58
|
|
|
* @Groups({"category:read","category_file:read","category_file:write"}) |
59
|
|
|
*/ |
60
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['file' => 'exact'])] |
61
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['file.fileType' => 'exact'])] |
62
|
|
|
|
63
|
|
|
private $file; |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @var Category |
67
|
|
|
* |
68
|
|
|
* @ORM\ManyToOne(targetEntity="Category") |
69
|
|
|
* @ORM\JoinColumns({ |
70
|
|
|
* @ORM\JoinColumn(name="category_id", referencedColumnName="id") |
71
|
|
|
* }) |
72
|
|
|
* @Groups({"category_file:read","category_file:write"}) |
73
|
|
|
*/ |
74
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['category' => 'exact'])] |
75
|
|
|
|
76
|
|
|
private $category; |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* Get the value of id |
80
|
|
|
*/ |
81
|
|
|
public function getId(): int |
82
|
|
|
{ |
83
|
|
|
return $this->id; |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* Get the value of file |
88
|
|
|
*/ |
89
|
|
|
public function getFile(): File |
90
|
|
|
{ |
91
|
|
|
return $this->file; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* Set the value of file |
96
|
|
|
*/ |
97
|
|
|
public function setFile(File $file): self |
98
|
|
|
{ |
99
|
|
|
$this->file = $file; |
|
|
|
|
100
|
|
|
|
101
|
|
|
return $this; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* Get the value of category |
106
|
|
|
*/ |
107
|
|
|
public function getCategory(): Category |
108
|
|
|
{ |
109
|
|
|
return $this->category; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* Set the value of category |
114
|
|
|
*/ |
115
|
|
|
public function setCategory(Category $category): self |
116
|
|
|
{ |
117
|
|
|
$this->category = $category; |
118
|
|
|
|
119
|
|
|
return $this; |
120
|
|
|
} |
121
|
|
|
} |
122
|
|
|
|
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