Passed
Push — master ( 295a68...64d74b )
by Luiz Kim
02:18
created

File::getPeople()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 1
c 2
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace ControleOnline\Entity;
4
5
use ApiPlatform\Metadata\GetCollection;
0 ignored issues
show
Bug introduced by
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...
6
use ApiPlatform\Metadata\Get;
0 ignored issues
show
Bug introduced by
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...
7
use ApiPlatform\Metadata\Post;
0 ignored issues
show
Bug introduced by
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...
8
use ApiPlatform\Metadata\ApiResource;
0 ignored issues
show
Bug introduced by
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\ApiProperty;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Metadata\ApiProperty 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\ApiFilter;
0 ignored issues
show
Bug introduced by
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...
11
use App\Controller\GetFileDataAction;
0 ignored issues
show
Bug introduced by
The type App\Controller\GetFileDataAction 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\Controller\FileUploadController;
13
use Doctrine\ORM\Mapping as ORM;
0 ignored issues
show
Bug introduced by
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...
14
use Symfony\Component\Serializer\Annotation\Groups;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Serializer\Annotation\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...
15
use Doctrine\Common\Collections\ArrayCollection;
0 ignored issues
show
Bug introduced by
The type Doctrine\Common\Collections\ArrayCollection 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
use Doctrine\Common\Collections\Collection;
0 ignored issues
show
Bug introduced by
The type Doctrine\Common\Collections\Collection 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...
17
use ApiPlatform\Doctrine\Orm\Filter\OrderFilter;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Doctrine\Orm\Filter\OrderFilter 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...
18
use ApiPlatform\Doctrine\Orm\Filter\ExistsFilter;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Doctrine\Orm\Filter\ExistsFilter 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...
19
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
0 ignored issues
show
Bug introduced by
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...
20
/**
21
 * File
22
 *
23
 * @ORM\EntityListeners ({ControleOnline\Listener\LogListener::class})
24
 * @ORM\Entity (repositoryClass="ControleOnline\Repository\FileRepository")
25
 * @ORM\Table (name="files", uniqueConstraints={@ORM\UniqueConstraint (name="url", columns={"url"}), @ORM\UniqueConstraint(name="path", columns={"path"})})
26
 */
27
#[ApiResource(
28
    operations: [
29
        new Get(security: 'is_granted(\'ROLE_CLIENT\')'),
30
        new Get(
31
            security: 'is_granted(\'IS_AUTHENTICATED_ANONYMOUSLY\')',
32
            uriTemplate: '/files/download/{id}',
33
            controller: GetFileDataAction::class
34
        ),
35
        new Post(
36
            security: 'is_granted(\'ROLE_CLIENT\')',
37
            uriTemplate: '/files/upload',
38
            controller: FileUploadController::class,
39
            deserialize: false
40
        ),
41
        new GetCollection(security: 'is_granted(\'ROLE_CLIENT\')')
42
    ],
43
44
    normalizationContext: ['groups' => ['file_read']],
45
    denormalizationContext: ['groups' => ['file_write']]
46
)]
47
class File
48
{
49
    /**
50
     *
51
     * @ORM\Column(type="integer", nullable=false)
52
     * @ORM\Id
53
     * @ORM\GeneratedValue(strategy="IDENTITY")
54
     * @Groups({"file_read","people_read"})
55
     */
56
    private $id;
57
58
    /**
59
     * @ORM\Column(type="string", length=255, nullable=false)
60
     * @Groups({"file_read","people_read"})
61
     */
62
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['file_type' => 'exact'])]
63
    private $file_type;
64
    /**
65
     * @ORM\Column(type="string", length=255, nullable=false)
66
     */
67
    private $content;
68
69
70
    /**
71
     * @var \ControleOnline\Entity\People
0 ignored issues
show
Bug introduced by
The type ControleOnline\Entity\People 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...
72
     *
73
     * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\People")
74
     * @ORM\JoinColumns({
75
     *   @ORM\JoinColumn(name="people_id", referencedColumnName="id")
76
     * })
77
     * @Groups({"file_read"})
78
     */
79
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['people' => 'exact'])]
80
81
    private $people;
82
83
    public function __construct()
84
    {
85
        $this->people = new \Doctrine\Common\Collections\ArrayCollection();
86
    }
87
88
    public function getId()
89
    {
90
        return $this->id;
91
    }
92
93
   
94
95
    /**
96
     * Get the value of file_type
97
     */
98
    public function getFileType()
99
    {
100
        return $this->file_type;
101
    }
102
103
    /**
104
     * Set the value of file_type
105
     */
106
    public function setFileType($file_type): self
107
    {
108
        $this->file_type = $file_type;
109
110
        return $this;
111
    }
112
113
    /**
114
     * Get the value of content
115
     */
116
    public function getContent()
117
    {
118
        return $this->content;
119
    }
120
121
    /**
122
     * Set the value of content
123
     */
124
    public function setContent($content): self
125
    {
126
        $this->content = $content;
127
128
        return $this;
129
    }
130
131
    /**
132
     * Get the value of people
133
     */
134
    public function getPeople()
135
    {
136
        return $this->people;
137
    }
138
139
    /**
140
     * Set the value of people
141
     */
142
    public function setPeople($people): self
143
    {
144
        $this->people = $people;
145
146
        return $this;
147
    }
148
}
149