Issues (587)

src/Entity/Spool.php (9 issues)

Labels
Severity
1
<?php
2
3
namespace ControleOnline\Entity;
4
5
use Symfony\Component\Serializer\Attribute\Groups;
0 ignored issues
show
The type Symfony\Component\Serializer\Attribute\Groups was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
0 ignored issues
show
The type ApiPlatform\Doctrine\Orm\Filter\SearchFilter was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use ApiPlatform\Metadata\ApiFilter;
0 ignored issues
show
The type ApiPlatform\Metadata\ApiFilter was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use ApiPlatform\Metadata\ApiResource;
0 ignored issues
show
The type ApiPlatform\Metadata\ApiResource was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use ApiPlatform\Metadata\Get;
0 ignored issues
show
The type ApiPlatform\Metadata\Get was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
use ApiPlatform\Metadata\GetCollection;
0 ignored issues
show
The type ApiPlatform\Metadata\GetCollection was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use ApiPlatform\Metadata\Post;
0 ignored issues
show
The type ApiPlatform\Metadata\Post was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
use ControleOnline\Listener\LogListener;
13
use ControleOnline\Repository\SpoolRepository;
14
use DateTime;
15
use Doctrine\ORM\Mapping as ORM;
0 ignored issues
show
The type Doctrine\ORM\Mapping was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
16
17
#[ApiResource(
18
    operations: [
19
        new Get(
20
            security: 'is_granted(\'ROLE_CLIENT\')',
21
            normalizationContext: ['groups' => ['spool_item:read']],
22
        ),
23
        new GetCollection(security: 'is_granted(\'ROLE_CLIENT\')'),
24
        new Post(securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')'),
25
    ],
26
    formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']],
27
    normalizationContext: ['groups' => ['spool:read']],
28
    denormalizationContext: ['groups' => ['spool:write']]
29
)]
30
#[ORM\Table(name: 'spool')]
31
#[ORM\Index(name: 'device_id_idx', columns: ['device_id'])]
32
#[ORM\Index(name: 'user_id_idx', columns: ['user_id'])]
33
#[ORM\Index(name: 'people_id_idx', columns: ['people_id'])]
34
#[ORM\EntityListeners([LogListener::class])]
35
#[ORM\Entity(repositoryClass: SpoolRepository::class)]
36
37
class Spool
38
{
39
    #[ORM\Column(name: 'id', type: 'integer', nullable: false)]
40
    #[ORM\Id]
41
    #[ORM\GeneratedValue(strategy: 'IDENTITY')]
42
    #[Groups(['spool_item:read', 'spool:read',])]
43
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['id' => 'exact'])]
44
45
    private $id;
46
47
48
    #[ORM\ManyToOne(targetEntity: Device::class)]
49
    #[ORM\JoinColumn(name: 'device_id', referencedColumnName: 'id')]
50
    #[Groups(['spool_item:read', 'spool:read', 'spool:write'])]
51
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['device' => 'exact'])]
52
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['device.device' => 'exact'])]
53
    private $device;
54
55
    #[ORM\ManyToOne(targetEntity: User::class)]
56
    #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id')]
57
    #[Groups(['spool_item:read', 'spool:read', 'spool:write'])]
58
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['user' => 'exact'])]
59
    private $user;
60
61
62
    #[ORM\Column(name: 'register_date', type: 'datetime', nullable: false)]
63
    #[Groups(['spool_item:read', 'spool:read', 'spool:write'])]
64
    private $registerDate;
65
66
    #[ORM\JoinColumn(name: 'status_id', referencedColumnName: 'id', nullable: false)]
67
    #[ORM\ManyToOne(targetEntity: Status::class)]
68
    #[Groups(['spool_item:read', 'spool:read', 'spool:write'])]
69
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['status' => 'exact'])]
70
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['status.status' => 'exact'])]
71
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['status.realStatus' => 'exact'])]
72
    private $status;
73
74
    #[ORM\JoinColumn(name: 'file_id', referencedColumnName: 'id', nullable: false)]
75
    #[ORM\ManyToOne(targetEntity: File::class)]
76
    #[Groups(['spool_item:read', 'spool:read', 'spool:write'])]
77
    private $file;
78
79
    public function __construct()
80
    {
81
        $this->registerDate = new DateTime('now');
82
    }
83
84
    public function getId()
85
    {
86
        return $this->id;
87
    }
88
89
    public function setUser(User $user): self
0 ignored issues
show
The type ControleOnline\Entity\User was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
90
    {
91
        $this->user = $user;
92
        return $this;
93
    }
94
95
    public function getUser(): User
96
    {
97
        return $this->user;
98
    }
99
100
    public function setRegisterDate($registerDate): self
101
    {
102
        $this->registerDate = $registerDate;
103
        return $this;
104
    }
105
106
    public function getRegisterDate()
107
    {
108
        return $this->registerDate;
109
    }
110
111
    public function setStatus(Status $status): self
112
    {
113
        $this->status = $status;
114
        return $this;
115
    }
116
117
    public function getStatus(): Status
118
    {
119
        return $this->status;
120
    }
121
122
    public function setFile(File $file): self
123
    {
124
        $this->file = $file;
125
        return $this;
126
    }
127
128
    public function getFile(): File
129
    {
130
        return $this->file;
131
    }
132
133
    /**
134
     * Get the value of device
135
     */
136
    public function getDevice(): Device
137
    {
138
        return $this->device;
139
    }
140
141
    /**
142
     * Set the value of device
143
     */
144
    public function setDevice(Device $device): self
145
    {
146
        $this->device = $device;
147
148
        return $this;
149
    }
150
}
151