Passed
Push — master ( 27fd8a...0e6745 )
by Luiz Kim
10:23 queued 02:06
created

ExtraFields::setFieldConfigs()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 1
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\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...
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 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...
12
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...
13
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...
14
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...
15
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...
16
17
/**
18
 * @ORM\EntityListeners ({ControleOnline\Listener\LogListener::class})
19
 * @ORM\Table (name="extra_fields")
20
 * @ORM\Entity (repositoryClass="ControleOnline\Repository\ExtraFieldsRepository")
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' => ['extra_fields_write']],
29
            denormalizationContext: ['groups' => ['extra_fields_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' => ['text/csv']],
35
    normalizationContext: ['groups' => ['extra_fields_read']],
36
    denormalizationContext: ['groups' => ['extra_fields_write']]
37
)]
38
#[ApiFilter(filterClass: SearchFilter::class, properties: ['context' => 'exact', 'field_type' => 'exact'])]
39
class ExtraFields
40
{
41
    /**
42
     * @var integer
43
     *
44
     * @ORM\Column(name="id", type="integer", nullable=false)
45
     * @ORM\Id
46
     * @Groups({"extra_fields_read", "extra_data_read"})
47
     * @ORM\GeneratedValue(strategy="IDENTITY")
48
     */
49
    private $id;
50
51
    /**
52
     * @ORM\Column(name="field_name", type="string", length=255, nullable=false)
53
     * @Groups({"extra_fields_read", "extra_fields_write", "extra_data_read"})
54
     */
55
    private $field_name;
56
    /**
57
     * @ORM\Column(name="field_type", type="string", length=255, nullable=false)
58
     * @Groups({"extra_fields_read", "extra_fields_write", "extra_data_read"})
59
     */
60
    private $field_type;
61
    /**
62
     * @ORM\Column(name="context", type="string", length=255, nullable=false)
63
     * @Groups({"extra_fields_read", "extra_fields_write", "extra_data_read"})
64
     */
65
    private $context;
66
    /**
67
     * @ORM\Column(name="required", type="boolean", nullable=true)
68
     * @Groups({"extra_fields_read", "extra_fields_write", "extra_data_read"})
69
     */
70
    private $required;
71
    /**
72
     * @ORM\Column(name="field_configs", type="string", nullable=true)
73
     * @Groups({"extra_fields_read", "extra_fields_write", "extra_data_read"})
74
     */
75
    private $field_configs;
76
    /**
77
     * Constructor
78
     */
79
    public function __construct()
80
    {
81
    }
82
    /**
83
     * Get id
84
     *
85
     * @return integer
86
     */
87
    public function getId()
88
    {
89
        return $this->id;
90
    }
91
92
    public function setFieldName($value): self
93
    {
94
        $this->field_name = $value;
95
        return $this;
96
    }
97
    public function getFieldName()
98
    {
99
        return $this->field_name;
100
    }
101
    public function setFieldType($value): self
102
    {
103
        $this->field_type = $value;
104
        return $this;
105
    }
106
    public function getFieldType()
107
    {
108
        return $this->field_type;
109
    }
110
    public function setContext($value): self
111
    {
112
        $this->context = $value;
113
        return $this;
114
    }
115
    public function getContext()
116
    {
117
        return $this->context;
118
    }
119
    public function setRequired($value): self
120
    {
121
        $this->required = $value;
122
        return $this;
123
    }
124
    public function getRequired()
125
    {
126
        return $this->required;
127
    }
128
    public function setFieldConfigs($value): self
129
    {
130
        $this->field_configs = $value;
131
        return $this;
132
    }
133
    public function getFieldConfigs()
134
    {
135
        return $this->field_configs;
136
    }
137
}
138