Passed
Push — master ( 792f55...7e2e5b )
by Luiz Kim
02:06
created

ContractPeople::setContract()   A

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
cc 1
eloc 2
c 2
b 0
f 0
nc 1
nop 1
dl 0
loc 4
rs 10
1
<?php
2
3
namespace ControleOnline\Entity;
4
5
use ApiPlatform\Metadata\Link;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Metadata\Link 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\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...
7
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...
8
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...
9
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...
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 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
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...
13
/**
14
 * @ORM\Table (name="contract_people")
15
 * @ORM\Entity
16
 * @ORM\EntityListeners ({ControleOnline\Listener\LogListener::class})
17
 */
18
#[ApiResource(operations: [new Get(security: 'is_granted(\'ROLE_CLIENT\')')], formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']])]
19
#[ApiResource(uriTemplate: '/people/{id}/contracts_peoples.{_format}', uriVariables: ['id' => new Link(fromClass: \ControleOnline\Entity\People::class, identifiers: ['id'], toProperty: 'people')], status: 200, operations: [new GetCollection()])]
20
class ContractPeople
21
{
22
    /**
23
     * @ORM\Column(type="integer", nullable=false)
24
     * @ORM\Id
25
     * @ORM\GeneratedValue(strategy="IDENTITY")
26
     * @Groups("contract_people:read")
27
     */
28
    private $id;
29
    /**
30
     * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\Contract")
31
     * @ORM\JoinColumns({
32
     *   @ORM\JoinColumn(name="contract_id", referencedColumnName="id", nullable=false)
33
     * })
34
     * @Groups("contract_people:read")
35
     */
36
    private $contract;
37
    /**
38
     * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\People", inversedBy="contractsPeople")
39
     * @ORM\JoinColumns({
40
     *   @ORM\JoinColumn(name="people_id", referencedColumnName="id", nullable=false)
41
     * })
42
     * @Groups("contract_people:read")
43
     */
44
    private $people;
45
    /**
46
     * @ORM\Column(name="people_type", type="string", columnDefinition="enum('Beneficiary', 'Witness', 'Payer', 'Provider')")
47
     * @Groups("contract_people:read")
48
     */
49
    private $people_type;
50
    /**
51
     * @ORM\Column(name="contract_percentage", type="float",  nullable=true)
52
     * @Groups("contract_people:read")
53
     */
54
    private $contract_percentage;
55
    public function getId() : int
56
    {
57
        return $this->id;
58
    }
59
    public function getContract() : Contract
60
    {
61
        return $this->contract;
62
    }
63
    public function setContract(Contract $contract) : ContractPeople
64
    {
65
        $this->contract = $contract;
66
        return $this;
67
    }
68
    public function getPeople() : 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...
69
    {
70
        return $this->people;
71
    }
72
    public function setPeople(People $people) : ContractPeople
73
    {
74
        $this->people = $people;
75
        return $this;
76
    }
77
    public function getPeopleType() : string
78
    {
79
        return $this->people_type;
80
    }
81
    public function setPeopleType(string $people_type) : ContractPeople
82
    {
83
        $this->people_type = $people_type;
84
        return $this;
85
    }
86
    public function getContractPercentage() : float
87
    {
88
        return $this->contract_percentage ?: 0;
89
    }
90
    public function setContractPercentage(float $contract_percentage) : ContractPeople
91
    {
92
        $this->contract_percentage = $contract_percentage;
93
        return $this;
94
    }
95
}
96