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

Contract::setStartDate()   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\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...
6
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...
7
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...
8
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...
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\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...
11
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...
12
use DateTime;
13
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...
14
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...
15
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...
16
/**
17
 * @ORM\EntityListeners ({ControleOnline\Listener\LogListener::class})
18
 * @ORM\Entity (repositoryClass="ControleOnline\Repository\ContractRepository")
19
 */
20
#[ApiResource(
21
    operations: [
22
        new Get(security: 'is_granted(\'ROLE_CLIENT\')'),
23
        new Put(security: 'is_granted(\'ROLE_CLIENT\')', uriTemplate: '/contracts/{id}/change/payment', controller: \App\Controller\ChangeContractPaymentAction::class),
24
        new Put(security: 'is_granted(\'ROLE_CLIENT\')', uriTemplate: '/contracts/{id}/change', controller: \App\Controller\ChangeContractAction::class),
25
        new Put(uriTemplate: 'contracts/{id}/status/{status}', controller: \App\Controller\ChangeContractStatusAction::class, openapiContext: []),
26
        new Post(),
27
        new GetCollection()
28
    ],
29
    formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']]
30
)]
31
class Contract
32
{
33
    /**
34
     * @ORM\Column(type="integer", nullable=false)
35
     * @ORM\Id
36
     * @ORM\GeneratedValue(strategy="IDENTITY")
37
     * @Groups({"contract_people:read", "task_read","logistic_read"})
38
     */
39
    private $id;
40
    /**
41
     * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\DocumentModel")
42
     * @ORM\JoinColumns({
43
     *   @ORM\JoinColumn(referencedColumnName="id", nullable=false)
44
     * })
45
     */
46
    private $contractModel;
47
    /**
48
     * @ORM\Column(name="contract_status", type="string")
49
     * @Groups("contract_people:read")
50
     */
51
    private $contractStatus;
52
    //, columnDefinition="enum('Active', 'Canceled', 'Amended')"
53
    /**
54
     * @ORM\Column(name="doc_key", type="string")
55
     * @Groups("contract_people:read")
56
     */
57
    private $doc_key;
58
    /**
59
     * @ORM\Column(name="start_date", type="datetime",  nullable=false)
60
     * @Groups("contract_people:read")
61
     */
62
    private $startDate;
63
    /**
64
     * @ORM\Column(name="end_date", type="datetime",  nullable=false)
65
     * @Groups("contract_people:read")
66
     */
67
    private $endDate;
68
    /**
69
     * @ORM\Column(name="creation_date", type="datetime",  nullable=false)
70
     */
71
    private $creationDate;
72
    /**
73
     * @ORM\Column(name="alter_date", type="datetime",  nullable=false)
74
     */
75
    private $alterDate;
76
    /**
77
     * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\DocumentModel")
78
     * @ORM\JoinColumns({
79
     *   @ORM\JoinColumn(name="contract_parent_id", referencedColumnName="id", nullable=true)
80
     * })
81
     */
82
    private $contractParent;
83
    /**
84
     * Many Contracts have Many Peoples.
85
     *
86
     * @ORM\ManyToMany(targetEntity="ControleOnline\Entity\People")
87
     * @ORM\JoinTable(name="contract_people",
88
     *      joinColumns={@ORM\JoinColumn(name="contract_id", referencedColumnName="id")},
89
     *      inverseJoinColumns={@ORM\JoinColumn(name="people_id", referencedColumnName="id")}
90
     *      )
91
     * @Groups({"task_read"})
92
     */
93
    private $peoples;
94
95
96
    public function __construct()
97
    {
98
        $this->startDate = new DateTime('now');
99
        $this->endDate = new DateTime('now');
100
        $this->creationDate = new DateTime('now');
101
        $this->alterDate = new DateTime('now');
102
    }
103
    public function getId() : int
104
    {
105
        return $this->id;
106
    }
107
    public function getDocumentModel() : DocumentModel
0 ignored issues
show
Bug introduced by
The type ControleOnline\Entity\DocumentModel 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...
108
    {
109
        return $this->contractModel;
110
    }
111
    public function setDocumentModel(DocumentModel $document_model) : Contract
112
    {
113
        $this->contractModel = $document_model;
114
        return $this;
115
    }
116
    public function getKey() : ?string
117
    {
118
        return $this->doc_key;
119
    }
120
    public function setKey(string $doc_key) : Contract
121
    {
122
        $this->doc_key = $doc_key;
123
        return $this;
124
    }
125
    public function getContractStatus() : string
126
    {
127
        return $this->contractStatus;
128
    }
129
    public function setContractStatus(string $contract_status) : Contract
130
    {
131
        $this->contractStatus = $contract_status;
132
        return $this;
133
    }
134
    public function getStartDate() : DateTime
135
    {
136
        return $this->startDate;
137
    }
138
    public function setStartDate(DateTime $start_date) : Contract
139
    {
140
        $this->startDate = $start_date;
141
        return $this;
142
    }
143
    public function getEndDate() : ?DateTime
144
    {
145
        return $this->endDate;
146
    }
147
    public function setEndDate(DateTime $end_date) : Contract
148
    {
149
        $this->endDate = $end_date;
150
        return $this;
151
    }
152
    public function getCreationDate() : DateTime
153
    {
154
        return $this->creationDate;
155
    }
156
    public function setCreationDate(DateTime $creation_date) : Contract
157
    {
158
        $this->creationDate = $creation_date;
159
        return $this;
160
    }
161
    public function getAlterDate() : DateTime
162
    {
163
        return $this->alterDate;
164
    }
165
    public function setAlterDate(DateTime $alter_date) : Contract
166
    {
167
        $this->alterDate = $alter_date;
168
        return $this;
169
    }
170
    /**
171
     * @return mixed
172
     */
173
    public function getContractParent()
174
    {
175
        return $this->contractParent;
176
    }
177
    public function setContractParentId(Contract $contractParent) : Contract
178
    {
179
        $this->contractParent = $contractParent;
180
        return $this;
181
    }
182
    public function getPeoples() : Collection
183
    {
184
        return $this->peoples;
185
    }
186
187
}
188