Passed
Push — master ( 1c186e...294dbb )
by Luiz Kim
32:05 queued 29:56
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\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...
8
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...
9
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...
10
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...
11
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...
12
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...
13
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...
14
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...
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
     * @ORM\Column(type="string", length=255, nullable=false)
49
     * @Groups({"product_file_read","people_read", "lesson:read", "task_interaction_read","display_read"})
50
     */
51
    private $url;
52
    /**
53
     * @ORM\Column(type="string", length=255, nullable=false)
54
     * @Groups({"lesson_upload_file:post", "lesson:read"})
55
     */
56
    private $file_type;
57
    /**
58
     * @ORM\Column(type="string", length=255, nullable=false)
59
     */
60
    private $content;
61
62
63
    /**
64
     * @ORM\OneToMany(targetEntity="ControleOnline\Entity\People", mappedBy="file")
65
     */
66
    private $people;
67
    public function __construct()
68
    {
69
        $this->people = new \Doctrine\Common\Collections\ArrayCollection();
70
    }
71
    public function getId()
72
    {
73
        return $this->id;
74
    }
75
    public function setUrl($url)
76
    {
77
        $this->url = $url;
78
        return $this;
79
    }
80
    public function getUrl()
81
    {
82
        return $this->url;
83
    }
84
85
    public function addPeople(People $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...
86
    {
87
        $this->people[] = $people;
88
        return $this;
89
    }
90
    public function removePeople(People $people)
91
    {
92
        $this->people->removeElement($people);
93
    }
94
    public function getPeople()
95
    {
96
        return $this->people;
97
    }
98
99
    /**
100
     * Get the value of file_type
101
     */
102
    public function getFileType()
103
    {
104
        return $this->file_type;
105
    }
106
107
    /**
108
     * Set the value of file_type
109
     */
110
    public function setFileType($file_type): self
111
    {
112
        $this->file_type = $file_type;
113
114
        return $this;
115
    }
116
117
    /**
118
     * Get the value of content
119
     */
120
    public function getContent()
121
    {
122
        return $this->content;
123
    }
124
125
    /**
126
     * Set the value of content
127
     */
128
    public function setContent($content): self
129
    {
130
        $this->content = $content;
131
132
        return $this;
133
    }
134
}
135