Translate::setLanguage()   A
last analyzed

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 Symfony\Component\Serializer\Attribute\Groups;
0 ignored issues
show
Bug introduced by
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
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\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...
9
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...
10
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...
11
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...
12
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...
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\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...
15
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...
16
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...
17
use Symfony\Component\Validator\Constraints as Assert;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Validator\Constraints 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 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...
19
use ControleOnline\Entity\Language;
20
use ControleOnline\Repository\TranslateRepository;
21
use ControleOnline\Listener\LogListener;
22
23
#[ORM\Table(name: 'translate')]
24
#[ORM\EntityListeners([LogListener::class])]
25
#[ORM\Entity(repositoryClass: TranslateRepository::class)]
26
#[ApiResource(
27
    formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']],
28
    normalizationContext: ['groups' => ['translate:read']],
29
    denormalizationContext: ['groups' => ['translate:write']],
30
    operations: [
31
        new GetCollection(security: "is_granted('PUBLIC_ACCESS')"),
32
        new Get(security: "is_granted('ROLE_ADMIN') or is_granted('ROLE_CLIENT')"),
33
        new Post(securityPostDenormalize: "is_granted('ROLE_CLIENT')"),
34
        new Put(
35
            security: "is_granted('ROLE_CLIENT')",
36
            denormalizationContext: ['groups' => ['translate:write']]
37
        ),
38
        new Delete(security: "is_granted('ROLE_CLIENT')")
39
    ]
40
)]
41
#[ApiFilter(OrderFilter::class, properties: ['key' => 'ASC'])]
42
#[ApiFilter(SearchFilter::class, properties: [
43
    'id' => 'exact',
44
    'people' => 'exact',
45
    'store' => 'exact',
46
    'type' => 'exact',
47
    'key' => 'exact',
48
    'language.language' => 'exact'
49
])]
50
class Translate
51
{
52
    #[ORM\Column(name: 'id', type: 'integer', nullable: false)]
53
    #[ORM\Id]
54
    #[ORM\GeneratedValue(strategy: 'IDENTITY')]
55
    #[Groups(['translate:read', 'translate:write'])]
56
    private $id;
57
58
    #[ORM\ManyToOne(targetEntity: People::class)]
59
    #[ORM\JoinColumn(name: 'people_id', referencedColumnName: 'id')]
60
    #[Groups(['translate:read', 'translate:write'])]
61
    private $people;
62
63
    #[ORM\Column(name: 'store', type: 'string', length: 100, nullable: false)]
64
    #[Groups(['translate:read', 'translate:write'])]
65
    #[Assert\NotBlank]
66
    private $store;
67
68
    #[ORM\Column(name: 'type', type: 'string', length: 100, nullable: false)]
69
    #[Groups(['translate:read', 'translate:write'])]
70
    #[Assert\NotBlank]
71
    private $type;
72
73
    #[ORM\Column(name: 'translate_key', type: 'string', length: 100, nullable: false)]
74
    #[Groups(['translate:read', 'translate:write'])]
75
    #[Assert\NotBlank]
76
    private $key;
77
78
    #[ORM\Column(name: 'translate', type: 'string', length: 100, nullable: false)]
79
    #[Groups(['translate:read', 'translate:write'])]
80
    #[Assert\NotBlank]
81
    private $translate;
82
83
    #[ORM\ManyToOne(targetEntity: Language::class)]
84
    #[ORM\JoinColumn(name: 'lang_id', referencedColumnName: 'id')]
85
    #[Groups(['translate:read', 'translate:write'])]
86
    private $language;
87
88
    public function getId()
89
    {
90
        return $this->id;
91
    }
92
93
    public function getPeople()
94
    {
95
        return $this->people;
96
    }
97
98
    public function setPeople($people): self
99
    {
100
        $this->people = $people;
101
        return $this;
102
    }
103
104
    public function getStore()
105
    {
106
        return $this->store;
107
    }
108
109
    public function setStore($store): self
110
    {
111
        $this->store = $store;
112
        return $this;
113
    }
114
115
    public function getType()
116
    {
117
        return $this->type;
118
    }
119
120
    public function setType($type): self
121
    {
122
        $this->type = $type;
123
        return $this;
124
    }
125
126
    public function getKey()
127
    {
128
        return $this->key;
129
    }
130
131
    public function setKey($key): self
132
    {
133
        $this->key = $key;
134
        return $this;
135
    }
136
137
    public function getTranslate()
138
    {
139
        return $this->translate;
140
    }
141
142
    public function setTranslate($translate): self
143
    {
144
        $this->translate = $translate;
145
        return $this;
146
    }
147
148
    public function getLanguage()
149
    {
150
        return $this->language;
151
    }
152
153
    public function setLanguage($language): self
154
    {
155
        $this->language = $language;
156
        return $this;
157
    }
158
}
159