ContractPeople::getPeople()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 3
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
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\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...
15
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...
16
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...
17
use ControleOnline\Entity\Contract;
18
use ControleOnline\Repository\ContractPeopleRepository;
19
use ControleOnline\Listener\LogListener;
0 ignored issues
show
Bug introduced by
The type ControleOnline\Listener\LogListener 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...
20
21
#[ORM\Table(name: 'contract_people')]
22
#[ORM\EntityListeners([LogListener::class])]
23
#[ORM\Entity(repositoryClass: ContractPeopleRepository::class)]
24
#[ApiResource(
25
    formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']],
26
    normalizationContext: ['groups' => ['contract_people:read']],
27
    denormalizationContext: ['groups' => ['contract_people:write']],
28
    security: "is_granted('ROLE_CLIENT')",
29
    operations: [
30
        new GetCollection(security: "is_granted('ROLE_CLIENT')"),
31
        new Get(security: "is_granted('ROLE_CLIENT')"),
32
        new Post(
33
            security: "is_granted('ROLE_ADMIN') or is_granted('ROLE_CLIENT')"
34
        ),
35
        new Put(
36
            security: "is_granted('ROLE_ADMIN') or is_granted('ROLE_CLIENT')",
37
            validationContext: ['groups' => ['contract_people:write']],
38
            denormalizationContext: ['groups' => ['contract_people:write']]
39
        ),
40
        new Delete(security: "is_granted('ROLE_CLIENT')")
41
    ]
42
)]
43
#[ApiFilter(SearchFilter::class, properties: [
44
    'id' => 'exact',
45
    'people.id' => 'exact',
46
    'peopleType' => 'exact',
47
    'contract' => 'exact'
48
])]
49
class ContractPeople
50
{
51
    #[ORM\Column(type: 'integer', nullable: false)]
52
    #[ORM\Id]
53
    #[ORM\GeneratedValue(strategy: 'IDENTITY')]
54
    #[Groups(['contract_people:read', 'contract:read'])]
55
    private $id;
56
57
    #[ORM\ManyToOne(targetEntity: People::class)]
58
    #[ORM\JoinColumn(name: 'people_id', referencedColumnName: 'id', nullable: false)]
59
    #[Groups(['contract_people:read', 'contract:read', 'contract_people:write'])]
60
    private $people;
61
62
    #[ORM\Column(name: 'people_type', type: 'string')]
63
    #[Groups(['contract_people:read', 'contract:read', 'contract_people:write'])]
64
    private $peopleType;
65
66
    #[ORM\ManyToOne(targetEntity: Contract::class, inversedBy: 'peoples')]
67
    #[ORM\JoinColumn(name: 'contract_id', referencedColumnName: 'id')]
68
    #[Groups(['contract_people:read', 'contract_people:write'])]
69
    private $contract;
70
71
    #[ORM\Column(name: 'contract_percentage', type: 'float', nullable: true)]
72
    #[Groups(['contract_people:read', 'contract:read', 'contract_people:write'])]
73
    private $contractPercentage;
74
75
    public function getId()
76
    {
77
        return $this->id;
78
    }
79
80
    public function setId($id): self
81
    {
82
        $this->id = $id;
83
        return $this;
84
    }
85
86
    public function getContract()
87
    {
88
        return $this->contract;
89
    }
90
91
    public function setContract($contract): self
92
    {
93
        $this->contract = $contract;
94
        return $this;
95
    }
96
97
    public function getPeople()
98
    {
99
        return $this->people;
100
    }
101
102
    public function setPeople($people): self
103
    {
104
        $this->people = $people;
105
        return $this;
106
    }
107
108
    public function getPeopleType()
109
    {
110
        return $this->peopleType;
111
    }
112
113
    public function setPeopleType($peopleType): self
114
    {
115
        $this->peopleType = $peopleType;
116
        return $this;
117
    }
118
119
    public function getContractPercentage()
120
    {
121
        return $this->contractPercentage;
122
    }
123
124
    public function setContractPercentage($contractPercentage): self
125
    {
126
        $this->contractPercentage = $contractPercentage;
127
        return $this;
128
    }
129
}
130