Category::setIcon()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 2
c 2
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\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...
8
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...
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\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...
12
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...
13
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...
14
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...
15
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...
16
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...
17
use ControleOnline\Filter\CustomOrFilter;
18
use ControleOnline\Listener\LogListener;
19
use ControleOnline\Repository\CategoryRepository;
20
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...
21
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...
22
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...
23
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...
24
25
#[ApiResource(
26
    operations: [
27
        new Get(security: 'is_granted(\'PUBLIC_ACCESS\')'),
28
        new Put(
29
            security: 'is_granted(\'ROLE_CLIENT\')',
30
            denormalizationContext: ['groups' => ['category:write']]
31
        ),
32
        new Delete(security: 'is_granted(\'ROLE_CLIENT\')'),
33
        new Post(securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')'),
34
        new GetCollection(
35
            security: 'is_granted(\'PUBLIC_ACCESS\')',
36
        )
37
    ],
38
    formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']],
39
    normalizationContext: ['groups' => ['category:read']],
40
    denormalizationContext: ['groups' => ['category:write']]
41
)]
42
#[ApiFilter(filterClass: ExistsFilter::class, properties: ['parent'])]
43
#[ApiFilter(filterClass: OrderFilter::class, properties: ['name'])]
44
#[ApiFilter(CustomOrFilter::class, properties: ['name', 'id', 'icon', 'color'])]
45
#[ORM\Table(name: 'category')]
46
#[ORM\EntityListeners([LogListener::class])]
47
#[ORM\Entity(repositoryClass: CategoryRepository::class)]
48
class Category
49
{
50
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['id' => 'exact'])]
51
    #[ORM\Column(name: 'id', type: 'integer', nullable: false)]
52
    #[ORM\Id]
53
    #[ORM\GeneratedValue(strategy: 'IDENTITY')]
54
    #[Groups(['product_category:read', 'logistic:read', 'invoice_details:read', 'category:read', 'task:read', 'company_expense:read', 'model:read', 'model_detail:read', 'menu:read', 'invoice:read'])]
55
    private $id;
56
57
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['name' => 'partial'])]
58
    #[ORM\Column(name: 'name', type: 'string', length: 100, nullable: false)]
59
    #[Assert\NotBlank]
60
    #[Assert\Type(type: 'string')]
61
    #[Groups(['product_category:read', 'menu:read', 'logistic:read', 'invoice_details:read', 'category:read', 'task:read', 'category:write', 'model:read', 'model_detail:read', 'company_expense:read', 'queue:read', 'invoice:read'])]
62
    private $name;
63
64
    #[ApiFilter(filterClass: ExistsFilter::class, properties: ['categoryFiles'])]
65
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['categoryFiles.file.fileType' => 'exact'])]
66
    #[ORM\OneToMany(targetEntity: CategoryFile::class, mappedBy: 'category')]
67
    #[Groups(['category:read'])]
68
    private $categoryFiles;
69
70
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['context' => 'exact'])]
71
    #[ORM\Column(name: 'context', type: 'string', length: 100, nullable: false)]
72
    #[Assert\NotBlank]
73
    #[Assert\Type(type: 'string')]
74
    #[Groups(['product_category:read', 'logistic:read', 'invoice_details:read', 'category:read', 'task:read', 'category:write', 'menu:read', 'model:read', 'model_detail:read', 'queue:read', 'invoice:read'])]
75
    private $context;
76
77
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['parent' => 'exact'])]
78
    #[ORM\JoinColumn(name: 'parent_id', referencedColumnName: 'id', nullable: true)]
79
    #[ORM\ManyToOne(targetEntity: self::class)]
80
    #[Groups(['logistic:read', 'invoice_details:read', 'category:read', 'task:read', 'category:write', 'model:read', 'model_detail:read', 'menu:read', 'queue:read'])]
81
    private $parent;
82
83
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['company' => 'exact'])]
84
    #[ORM\JoinColumn(name: 'company_id', referencedColumnName: 'id')]
85
    #[ORM\ManyToOne(targetEntity: People::class)]
86
    #[Assert\NotBlank]
87
    #[Groups(['product_category:read', 'logistic:read', 'invoice_details:read', 'category:read', 'category:write', 'menu:read', 'model:read', 'model_detail:read', 'queue:read', 'invoice:read'])]
88
    private $company;
89
90
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['icon' => 'exact'])]
91
    #[ORM\Column(name: 'icon', type: 'string', length: 50, nullable: true)]
92
    #[Assert\Type(type: 'string')]
93
    #[Groups(['product_category:read', 'logistic:read', 'invoice_details:read', 'category:read', 'task:read', 'category:write', 'company_expense:read', 'model:read', 'model_detail:read', 'menu:read', 'queue:read', 'invoice:read'])]
94
    private $icon;
95
96
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['color' => 'exact'])]
97
    #[ORM\Column(name: 'color', type: 'string', length: 50, nullable: true)]
98
    #[Assert\Type(type: 'string')]
99
    #[Groups(['product_category:read', 'logistic:read', 'invoice_details:read', 'category:read', 'task:read', 'category:write', 'company_expense:read', 'model:read', 'model_detail:read', 'menu:read', 'queue:read', 'invoice:read'])]
100
    private $color;
101
102
    public function __construct()
103
    {
104
        $this->categoryFiles = new ArrayCollection();
105
    }
106
107
    public function getId()
108
    {
109
        return $this->id;
110
    }
111
112
    public function setName($name)
113
    {
114
        $this->name = $name;
115
        return $this;
116
    }
117
118
    public function getName()
119
    {
120
        return $this->name;
121
    }
122
123
    public function setContext($context)
124
    {
125
        $this->context = $context;
126
        return $this;
127
    }
128
129
    public function getContext()
130
    {
131
        return $this->context;
132
    }
133
134
    public function setParent(Category $category = null)
135
    {
136
        $this->parent = $category;
137
        return $this;
138
    }
139
140
    public function getParent(): ?Category
141
    {
142
        return $this->parent;
143
    }
144
145
    public function setCompany(People $company)
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...
146
    {
147
        $this->company = $company;
148
        return $this;
149
    }
150
151
    public function getCompany()
152
    {
153
        return $this->company;
154
    }
155
156
    public function getIcon()
157
    {
158
        return $this->icon;
159
    }
160
161
    public function setIcon($icon): self
162
    {
163
        $this->icon = $icon;
164
        return $this;
165
    }
166
167
    public function getColor()
168
    {
169
        return $this->color;
170
    }
171
172
    public function setColor($color): self
173
    {
174
        $this->color = $color;
175
        return $this;
176
    }
177
178
    public function getCategoryFiles(): Collection
179
    {
180
        return $this->categoryFiles;
181
    }
182
}