|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace ControleOnline\Entity; |
|
4
|
|
|
|
|
5
|
|
|
use ApiPlatform\Metadata\GetCollection; |
|
|
|
|
|
|
6
|
|
|
use ApiPlatform\Metadata\Post; |
|
|
|
|
|
|
7
|
|
|
use ApiPlatform\Metadata\Delete; |
|
|
|
|
|
|
8
|
|
|
use ApiPlatform\Metadata\Put; |
|
|
|
|
|
|
9
|
|
|
use ApiPlatform\Metadata\Get; |
|
|
|
|
|
|
10
|
|
|
use ApiPlatform\Metadata\ApiResource; |
|
|
|
|
|
|
11
|
|
|
use ApiPlatform\Metadata\ApiProperty; |
|
|
|
|
|
|
12
|
|
|
use ApiPlatform\Doctrine\Orm\Filter\OrderFilter; |
|
|
|
|
|
|
13
|
|
|
use ApiPlatform\Doctrine\Orm\Filter\ExistsFilter; |
|
|
|
|
|
|
14
|
|
|
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter; |
|
|
|
|
|
|
15
|
|
|
use ApiPlatform\Metadata\ApiFilter; |
|
|
|
|
|
|
16
|
|
|
use ControleOnline\Controller\AddDeviceConfigAction; |
|
17
|
|
|
use ControleOnline\Filter\CustomOrFilter; |
|
18
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
|
|
|
|
|
19
|
|
|
use stdClass; |
|
20
|
|
|
use Symfony\Component\Serializer\Annotation\Groups; |
|
|
|
|
|
|
21
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
|
|
|
|
|
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* @ORM\EntityListeners ({ControleOnline\Listener\LogListener::class}) |
|
25
|
|
|
* @ORM\Table (name="device") |
|
26
|
|
|
* @ORM\Entity (repositoryClass="ControleOnline\Repository\DeviceRepository") |
|
27
|
|
|
*/ |
|
28
|
|
|
#[ApiResource( |
|
29
|
|
|
operations: [ |
|
30
|
|
|
new Get(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')'), |
|
31
|
|
|
new Put( |
|
32
|
|
|
security: 'is_granted(\'ROLE_CLIENT\')', |
|
33
|
|
|
denormalizationContext: ['groups' => ['device:write']] |
|
34
|
|
|
), |
|
35
|
|
|
new Post( |
|
36
|
|
|
security: 'is_granted(\'ROLE_CLIENT\')', |
|
37
|
|
|
uriTemplate: '/devices/add-configs', |
|
38
|
|
|
controller: AddDeviceConfigAction::class |
|
39
|
|
|
), |
|
40
|
|
|
new Delete(security: 'is_granted(\'ROLE_CLIENT\')'), |
|
41
|
|
|
new Post(securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')'), |
|
42
|
|
|
new GetCollection( |
|
43
|
|
|
security: 'is_granted(\'IS_AUTHENTICATED_ANONYMOUSLY\')', |
|
44
|
|
|
) |
|
45
|
|
|
], |
|
46
|
|
|
formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
|
47
|
|
|
normalizationContext: ['groups' => ['device:read']], |
|
48
|
|
|
denormalizationContext: ['groups' => ['device:write']] |
|
49
|
|
|
)] |
|
50
|
|
|
#[ApiFilter(filterClass: OrderFilter::class, properties: ['id' => 'ASC'])] |
|
51
|
|
|
|
|
52
|
|
|
class Device |
|
53
|
|
|
{ |
|
54
|
|
|
/** |
|
55
|
|
|
* @var integer |
|
56
|
|
|
* |
|
57
|
|
|
* @ORM\Column(name="id", type="integer", nullable=false) |
|
58
|
|
|
* @ORM\Id |
|
59
|
|
|
* @ORM\GeneratedValue(strategy="IDENTITY") |
|
60
|
|
|
* @Groups({"device:read","device:write"}) |
|
61
|
|
|
*/ |
|
62
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['id' => 'exact'])] |
|
63
|
|
|
|
|
64
|
|
|
private $id; |
|
65
|
|
|
|
|
66
|
|
|
|
|
67
|
|
|
|
|
68
|
|
|
/** |
|
69
|
|
|
* @var string |
|
70
|
|
|
* |
|
71
|
|
|
* @ORM\Column(name="device", type="string", length=100, nullable=false) |
|
72
|
|
|
* @Groups({"device:read","device:write"}) |
|
73
|
|
|
* @Assert\NotBlank |
|
74
|
|
|
*/ |
|
75
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['device' => 'exact'])] |
|
76
|
|
|
|
|
77
|
|
|
private $device; |
|
78
|
|
|
|
|
79
|
|
|
|
|
80
|
|
|
|
|
81
|
|
|
/** |
|
82
|
|
|
* Get the value of id |
|
83
|
|
|
*/ |
|
84
|
|
|
public function getId() |
|
85
|
|
|
{ |
|
86
|
|
|
return $this->id; |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
|
|
90
|
|
|
/** |
|
91
|
|
|
* Get the value of device |
|
92
|
|
|
*/ |
|
93
|
|
|
public function getDevice() |
|
94
|
|
|
{ |
|
95
|
|
|
return $this->device; |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
|
|
/** |
|
99
|
|
|
* Set the value of device |
|
100
|
|
|
*/ |
|
101
|
|
|
public function setDevice($device): self |
|
102
|
|
|
{ |
|
103
|
|
|
$this->device = $device; |
|
104
|
|
|
|
|
105
|
|
|
return $this; |
|
106
|
|
|
} |
|
107
|
|
|
} |
|
108
|
|
|
|
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