PeopleLink::getId()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace ControleOnline\Entity;
4
5
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...
6
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...
7
use ControleOnline\Repository\PeopleLinkRepository;
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\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...
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 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
13
#[ORM\Table(name: 'people_link')]
14
#[ORM\Index(name: 'company_id', columns: ['company'])]
15
#[ORM\UniqueConstraint(name: 'people_id', columns: ['people_id', 'company'])]
16
#[ORM\Entity(repositoryClass: PeopleLinkRepository::class)]
17
18
#[ApiResource(
19
    formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => 'text/csv'],
20
    normalizationContext: ['groups' => ['people_link:read']],
21
    denormalizationContext: ['groups' => ['people_link:write']],
22
    security: "is_granted('ROLE_CLIENT')",
23
    operations: [
24
        new GetCollection(securityPostDenormalize: "is_granted('ROLE_CLIENT')"),
25
    ]
26
)]
27
#[ApiFilter(SearchFilter::class, properties: [
28
    'id' => 'exact',
29
    'company' => 'exact',
30
    'people' => 'exact',
31
    'link_type' => 'exact',
32
    'enable' => 'exact',
33
])]
34
class PeopleLink
35
{
36
    #[ORM\Column(type: 'integer', nullable: false)]
37
    #[ORM\Id]
38
    #[ORM\GeneratedValue(strategy: 'IDENTITY')]
39
    #[Groups(['people_link:read', 'people_link:write'])]
40
    private $id;
41
42
    /**
43
     * @var People
44
     */
45
    #[ORM\JoinColumn(name: 'company_id', referencedColumnName: 'id')]
46
    #[ORM\ManyToOne(targetEntity: People::class, inversedBy: 'company')]
47
    #[Groups(['people_link:read', 'people_link:write'])]
48
    private $company;
49
50
    /**
51
     * @var People
52
     */
53
    #[ORM\JoinColumn(name: 'people_id', referencedColumnName: 'id')]
54
    #[ORM\ManyToOne(targetEntity: People::class, inversedBy: 'link')]
55
    #[Groups(['people_link:read', 'people_link:write'])]
56
57
    private $people;
58
59
    #[ORM\Column(type: 'boolean', nullable: false)]
60
    #[Groups(['people_link:read', 'people_link:write'])]
61
62
    private $enable = 1;
63
64
65
    /**
66
     * @var string
67
     *
68
     */
69
    #[ORM\Column(name: 'link_type', type: 'string', columnDefinition: "ENUM('employee','client','provider','franchisee')", nullable: false)]
70
    #[Groups(['people_link:read', 'people_link:write'])]
71
72
    private $link_type;
73
74
75
    /**
76
     * @var float
77
     */
78
    #[ORM\Column(name: 'comission', type: 'float', nullable: false)]
79
    #[Groups(['people_link:read', 'people_link:write'])]
80
81
    private $comission = 0;
82
83
84
    /**
85
     * @var float
86
     */
87
    #[ORM\Column(name: 'minimum_comission', type: 'float', nullable: false)]
88
    #[Groups(['people_link:read', 'people_link:write'])]
89
90
    private $minimum_comission = 0;
91
92
    public function getId()
93
    {
94
        return $this->id;
95
    }
96
97
    public function setCompany(People $company = null)
98
    {
99
        $this->company = $company;
100
101
        return $this;
102
    }
103
104
    public function getCompany()
105
    {
106
        return $this->company;
107
    }
108
109
    public function setPeople(People $people = null)
110
    {
111
        $this->people = $people;
112
113
        return $this;
114
    }
115
116
    public function getPeople()
117
    {
118
        return $this->people;
119
    }
120
121
    public function getEnabled()
122
    {
123
        return $this->enable;
124
    }
125
126
    public function setEnabled($enable)
127
    {
128
        $this->enable = $enable ?: 0;
129
130
        return $this;
131
    }
132
133
134
    /**
135
     * Set minimum_comission
136
     *
137
     * @param float $minimum_comission
138
     * @return PeopleSalesman
0 ignored issues
show
Bug introduced by
The type ControleOnline\Entity\PeopleSalesman 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...
139
     */
140
    public function setMinimumComission($minimum_comission): self
141
    {
142
        $this->minimum_comission = $minimum_comission;
143
144
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type ControleOnline\Entity\PeopleLink which is incompatible with the documented return type ControleOnline\Entity\PeopleSalesman.
Loading history...
145
    }
146
147
    /**
148
     * Get minimum_comission
149
     *
150
     * @return float
151
     */
152
    public function getMinimumComission(): float
153
    {
154
        return $this->minimum_comission;
155
    }
156
157
158
    /**
159
     * Set comission
160
     *
161
     * @param float $comission
162
     * @return PeopleSalesman
163
     */
164
    public function setComission($comission): self
165
    {
166
        $this->comission = $comission;
167
168
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type ControleOnline\Entity\PeopleLink which is incompatible with the documented return type ControleOnline\Entity\PeopleSalesman.
Loading history...
169
    }
170
171
    /**
172
     * Get comission
173
     *
174
     * @return float
175
     */
176
    public function getComission(): float
177
    {
178
        return $this->comission;
179
    }
180
181
    /**
182
     * Get the value of link_type
183
     */
184
    public function getLinkType()
185
    {
186
        return $this->link_type;
187
    }
188
189
    /**
190
     * Set the value of link_type
191
     */
192
    public function setLinkType($link_type): self
193
    {
194
        $this->link_type = $link_type;
195
196
        return $this;
197
    }
198
}
199