Passed
Push — master ( bc2475...d9d511 )
by Luiz Kim
02:22
created

ExtraData::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 0
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 2
rs 10
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 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...
11
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...
12
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...
13
use ApiPlatform\Metadata\Delete;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Metadata\Delete 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 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...
15
use ApiPlatform\Metadata\Put;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Metadata\Put 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
/**
18
 * @ORM\EntityListeners ({ControleOnline\Listener\LogListener::class})
19
 * @ORM\Table (name="extra_data")
20
 * @ORM\Entity (repositoryClass="ControleOnline\Repository\ExtraDataRepository")
21
 */
22
#[ApiResource(
23
    operations: [
24
        new Get(security: 'is_granted(\'ROLE_CLIENT\')'),
25
        new GetCollection(security: 'is_granted(\'ROLE_CLIENT\')'),
26
        new Put(
27
            security: 'is_granted(\'ROLE_ADMIN\') or (is_granted(\'ROLE_CLIENT\'))',
28
            validationContext: ['groups' => ['extrafields_write']],
29
            denormalizationContext: ['groups' => ['extrafields_write']]
30
        ),
31
        new Delete(security: 'is_granted(\'ROLE_CLIENT\')'),
32
        new Post(securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')'),
33
    ],
34
    formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' =>
35
    ['text/csv']],
36
    normalizationContext: ['groups' => ['extra_data_read']],
37
    denormalizationContext: ['groups' => ['extra_data_write']]
38
)]
39
#[ApiFilter(filterClass: SearchFilter::class, properties: ['id' => 'exact', 'type' => 'exact', 'people' => 'exact'])]
40
41
class ExtraData
42
{
43
    /**
44
     * @var integer
45
     *
46
     * @ORM\Column(name="id", type="integer", nullable=false)
47
     * @ORM\Id
48
     * @Groups({"extrafields_read", "extra_data_read"})
49
     * @ORM\GeneratedValue(strategy="IDENTITY")
50
     */
51
    private $id;
52
    /**
53
     * @var \ControleOnline\Entity\ExtraFields
54
     *
55
     * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\ExtraFields")
56
     * @ORM\JoinColumns({
57
     *   @ORM\JoinColumn(name="extra_fields_id", referencedColumnName="id")
58
     * })
59
     * @Groups({"extra_data_read"})
60
     */
61
    private $extra_fields;
62
63
    /**
64
     * @ORM\Column(name="entity_id", type="string", nullable=false)
65
     * @Groups({"extra_data_read"})
66
     */
67
    private $entity_id;
68
69
    /**
70
     * @ORM\Column(name="entity_name", type="string", nullable=false)
71
     * @Groups({"extra_data_read"})
72
     */
73
    private $entity_name;
74
75
    /**
76
     * @ORM\Column(name="data_value", type="string", nullable=false)
77
     * @Groups({"extra_data_read"})
78
     */
79
    private $value;
80
    /**
81
     * Constructor
82
     */
83
    public function __construct()
84
    {
85
    }
86
    /**
87
     * Get id
88
     *
89
     * @return integer
90
     */
91
    public function getId()
92
    {
93
        return $this->id;
94
    }
95
    public function setType(ExtraFields $extra_fields)
96
    {
97
        $this->extra_fields = $extra_fields;
98
        return $this;
99
    }
100
    public function getType()
101
    {
102
        return $this->extra_fields;
103
    }
104
105
    public function setValue($value): self
106
    {
107
        $this->value = $value;
108
        return $this;
109
    }
110
    public function getValue()
111
    {
112
        return $this->value;
113
    }
114
115
    /**
116
     * Get the value of entity_id
117
     */
118
    public function getEntityId()
119
    {
120
        return $this->entity_id;
121
    }
122
123
    /**
124
     * Set the value of entity_id
125
     */
126
    public function setEntityId($entity_id): self
127
    {
128
        $this->entity_id = $entity_id;
129
130
        return $this;
131
    }
132
133
    /**
134
     * Get the value of entity_name
135
     */
136
    public function getEntityName()
137
    {
138
        return $this->entity_name;
139
    }
140
141
    /**
142
     * Set the value of entity_name
143
     */
144
    public function setEntityName($entity_name): self
145
    {
146
        $this->entity_name = $entity_name;
147
148
        return $this;
149
    }
150
}
151