1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace ControleOnline\Entity; |
4
|
|
|
|
5
|
|
|
use ApiPlatform\Metadata\GetCollection; |
|
|
|
|
6
|
|
|
use ApiPlatform\Metadata\Get; |
|
|
|
|
7
|
|
|
use ApiPlatform\Metadata\ApiResource; |
|
|
|
|
8
|
|
|
use ApiPlatform\Metadata\ApiProperty; |
|
|
|
|
9
|
|
|
use ApiPlatform\Metadata\ApiFilter; |
|
|
|
|
10
|
|
|
use App\Controller\GetFileDataAction; |
|
|
|
|
11
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
|
|
|
12
|
|
|
use Symfony\Component\Serializer\Annotation\Groups; |
|
|
|
|
13
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
|
|
|
|
14
|
|
|
use Doctrine\Common\Collections\Collection; |
|
|
|
|
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* File |
18
|
|
|
* |
19
|
|
|
* @ORM\EntityListeners ({ControleOnline\Listener\LogListener::class}) |
20
|
|
|
* @ORM\Entity (repositoryClass="ControleOnline\Repository\FileRepository") |
21
|
|
|
* @ORM\Table (name="files", uniqueConstraints={@ORM\UniqueConstraint (name="url", columns={"url"}), @ORM\UniqueConstraint(name="path", columns={"path"})}) |
22
|
|
|
*/ |
23
|
|
|
#[ApiResource( |
24
|
|
|
operations: [ |
25
|
|
|
new Get(security: 'is_granted(\'ROLE_CLIENT\')'), |
26
|
|
|
new Get( |
27
|
|
|
security: 'is_granted(\'IS_AUTHENTICATED_ANONYMOUSLY\')', |
28
|
|
|
uriTemplate: '/files/download/{id}', |
29
|
|
|
controller: GetFileDataAction::class |
30
|
|
|
), |
31
|
|
|
new GetCollection(security: 'is_granted(\'ROLE_CLIENT\')') |
32
|
|
|
], |
33
|
|
|
|
34
|
|
|
normalizationContext: ['groups' => ['file_read']], |
35
|
|
|
denormalizationContext: ['groups' => ['file_write']] |
36
|
|
|
)] |
37
|
|
|
class File |
38
|
|
|
{ |
39
|
|
|
/** |
40
|
|
|
* |
41
|
|
|
* @ORM\Column(type="integer", nullable=false) |
42
|
|
|
* @ORM\Id |
43
|
|
|
* @ORM\GeneratedValue(strategy="IDENTITY") |
44
|
|
|
* @Groups({"product_file_read","lesson_upload_file:post", "people_read", "task_interaction_read","display_read"}) |
45
|
|
|
*/ |
46
|
|
|
private $id; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @ORM\Column(type="string", length=255, nullable=false) |
50
|
|
|
* @Groups({"lesson_upload_file:post", "people_read", "lesson:read"}) |
51
|
|
|
*/ |
52
|
|
|
private $file_type; |
53
|
|
|
/** |
54
|
|
|
* @ORM\Column(type="string", length=255, nullable=false) |
55
|
|
|
*/ |
56
|
|
|
private $content; |
57
|
|
|
|
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @ORM\OneToMany(targetEntity="ControleOnline\Entity\People", mappedBy="file") |
61
|
|
|
*/ |
62
|
|
|
private $people; |
63
|
|
|
|
64
|
|
|
public function __construct() |
65
|
|
|
{ |
66
|
|
|
$this->people = new \Doctrine\Common\Collections\ArrayCollection(); |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
public function getId() |
70
|
|
|
{ |
71
|
|
|
return $this->id; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
public function addPeople(People $people) |
|
|
|
|
75
|
|
|
{ |
76
|
|
|
$this->people[] = $people; |
77
|
|
|
return $this; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
public function removePeople(People $people) |
81
|
|
|
{ |
82
|
|
|
$this->people->removeElement($people); |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
public function getPeople() |
86
|
|
|
{ |
87
|
|
|
return $this->people; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* Get the value of file_type |
92
|
|
|
*/ |
93
|
|
|
public function getFileType() |
94
|
|
|
{ |
95
|
|
|
return $this->file_type; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* Set the value of file_type |
100
|
|
|
*/ |
101
|
|
|
public function setFileType($file_type): self |
102
|
|
|
{ |
103
|
|
|
$this->file_type = $file_type; |
104
|
|
|
|
105
|
|
|
return $this; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* Get the value of content |
110
|
|
|
*/ |
111
|
|
|
public function getContent() |
112
|
|
|
{ |
113
|
|
|
return $this->content; |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* Set the value of content |
118
|
|
|
*/ |
119
|
|
|
public function setContent($content): self |
120
|
|
|
{ |
121
|
|
|
$this->content = $content; |
122
|
|
|
|
123
|
|
|
return $this; |
124
|
|
|
} |
125
|
|
|
} |
126
|
|
|
|
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