1
|
|
|
<?php |
2
|
|
|
namespace ControleOnline\Entity; |
3
|
|
|
|
4
|
|
|
use Symfony\Component\Serializer\Attribute\Groups; |
|
|
|
|
5
|
|
|
|
6
|
|
|
use ApiPlatform\Metadata\ApiResource; |
|
|
|
|
7
|
|
|
use ApiPlatform\Metadata\ApiFilter; |
|
|
|
|
8
|
|
|
use ApiPlatform\Metadata\Get; |
|
|
|
|
9
|
|
|
use ApiPlatform\Metadata\GetCollection; |
|
|
|
|
10
|
|
|
use ApiPlatform\Metadata\Post; |
|
|
|
|
11
|
|
|
use ApiPlatform\Metadata\Put; |
|
|
|
|
12
|
|
|
use ApiPlatform\Metadata\Delete; |
|
|
|
|
13
|
|
|
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter; |
|
|
|
|
14
|
|
|
use ApiPlatform\Doctrine\Orm\Filter\OrderFilter; |
|
|
|
|
15
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
|
|
|
16
|
|
|
use ControleOnline\Entity\People; |
|
|
|
|
17
|
|
|
use ControleOnline\Repository\InventoryRepository; |
18
|
|
|
use ControleOnline\Listener\LogListener; |
|
|
|
|
19
|
|
|
|
20
|
|
|
#[ORM\Table(name: 'inventory')] |
21
|
|
|
#[ORM\Index(name: 'people_id', columns: ['people_id'])] |
22
|
|
|
#[ORM\Entity(repositoryClass: InventoryRepository::class)] |
23
|
|
|
#[ApiResource( |
24
|
|
|
formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => 'text/csv'], |
25
|
|
|
normalizationContext: ['groups' => ['inventory:read']], |
26
|
|
|
denormalizationContext: ['groups' => ['inventory:write']], |
27
|
|
|
operations: [ |
28
|
|
|
new GetCollection(security: "is_granted('PUBLIC_ACCESS')"), |
29
|
|
|
new Get(security: "is_granted('PUBLIC_ACCESS')"), |
30
|
|
|
new Post(securityPostDenormalize: "is_granted('ROLE_CLIENT')"), |
31
|
|
|
new Put( |
32
|
|
|
security: "is_granted('ROLE_CLIENT')", |
33
|
|
|
denormalizationContext: ['groups' => ['inventory:write']] |
34
|
|
|
), |
35
|
|
|
new Delete(security: "is_granted('ROLE_CLIENT')") |
36
|
|
|
] |
37
|
|
|
)] |
38
|
|
|
#[ApiFilter(OrderFilter::class, properties: ['inventory', 'type'])] |
39
|
|
|
#[ApiFilter(SearchFilter::class, properties: [ |
40
|
|
|
'id' => 'exact', |
41
|
|
|
'inventory' => 'partial', |
42
|
|
|
'type' => 'exact', |
43
|
|
|
'people' => 'exact' |
44
|
|
|
])] |
45
|
|
|
class Inventory |
46
|
|
|
{ |
47
|
|
|
#[ORM\Column(name: 'id', type: 'integer', nullable: false)] |
48
|
|
|
#[ORM\Id] |
49
|
|
|
#[ORM\GeneratedValue(strategy: 'IDENTITY')] |
50
|
|
|
#[Groups(['inventory:read', 'inventory:write'])] |
51
|
|
|
private $id; |
52
|
|
|
|
53
|
|
|
#[ORM\Column(name: 'inventory', type: 'string', length: 255, nullable: false)] |
54
|
|
|
#[Groups(['inventory:read', 'inventory:write'])] |
55
|
|
|
private $inventory; |
56
|
|
|
|
57
|
|
|
#[ORM\Column(name: 'type', type: 'string', length: 50, nullable: false)] |
58
|
|
|
#[Groups(['inventory:read', 'inventory:write'])] |
59
|
|
|
private $type; |
60
|
|
|
|
61
|
|
|
#[ORM\ManyToOne(targetEntity: People::class)] |
62
|
|
|
#[ORM\JoinColumn(name: 'people_id', referencedColumnName: 'id', nullable: false)] |
63
|
|
|
#[Groups(['inventory:read', 'inventory:write'])] |
64
|
|
|
private $people; |
65
|
|
|
|
66
|
|
|
public function getId(): ?int |
67
|
|
|
{ |
68
|
|
|
return $this->id; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
public function setId(int $id): self |
72
|
|
|
{ |
73
|
|
|
$this->id = $id; |
74
|
|
|
return $this; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
public function getInventory(): ?string |
78
|
|
|
{ |
79
|
|
|
return $this->inventory; |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
public function setInventory(string $inventory): self |
83
|
|
|
{ |
84
|
|
|
$this->inventory = $inventory; |
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 getPeople(): ?People |
100
|
|
|
{ |
101
|
|
|
return $this->people; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
public function setPeople(People $people): self |
105
|
|
|
{ |
106
|
|
|
$this->people = $people; |
107
|
|
|
return $this; |
108
|
|
|
} |
109
|
|
|
} |
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