Passed
Push — master ( 1cfe66...fe4de9 )
by Luiz Kim
09:41 queued 07:37
created

Contract::getPeoples()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 2
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\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\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\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...
11
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...
12
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...
13
use DateTime;
14
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...
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 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...
17
18
/**
19
 * @ORM\EntityListeners ({ControleOnline\Listener\LogListener::class})
20
 * @ORM\Entity (repositoryClass="ControleOnline\Repository\ContractRepository")
21
 */
22
#[ApiResource(
23
    operations: [
24
        new Get(security: 'is_granted(\'ROLE_CLIENT\')'),
25
        new Put(
26
            security: 'is_granted(\'ROLE_CLIENT\')',
27
            uriTemplate: '/contracts/{id}/change/payment',
28
            controller: \App\Controller\ChangeContractPaymentAction::class
29
        ),
30
        new Put(
31
            security: 'is_granted(\'ROLE_CLIENT\')',
32
            uriTemplate: '/contracts/{id}/change',
33
            controller: \App\Controller\ChangeContractAction::class
34
        ),
35
        new Put(
36
            uriTemplate: 'contracts/{id}/status/{status}',
37
            controller: \App\Controller\ChangeContractStatusAction::class,
38
            openapiContext: []
39
        ),
40
        new Post(),
41
        new GetCollection(security: 'is_granted(\'ROLE_CLIENT\')')
42
    ],
43
    formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']],
44
    normalizationContext: ['groups' => ['contract_read']],
45
    denormalizationContext: ['groups' => ['contract_write']]
46
)]
47
class Contract
48
{
49
    /**
50
     * @ORM\Column(type="integer", nullable=false)
51
     * @ORM\Id
52
     * @ORM\GeneratedValue(strategy="IDENTITY")
53
     * @Groups({ "contract_read"})
54
     */
55
    private $id;
56
    /**
57
     * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\Model")
58
     * @ORM\JoinColumns({
59
     *   @ORM\JoinColumn(referencedColumnName="id", nullable=false)
60
     * })
61
     * @Groups({"contract_read"})
62
     */
63
    private $contractModel;
64
65
66
    /**
67
     * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\File")
68
     * @ORM\JoinColumns({
69
     *   @ORM\JoinColumn(referencedColumnName="id", nullable=false)
70
     * })
71
     * @Groups({"contract_read"})
72
     */
73
    private $contractFile;
74
75
    /**
76
     * @var \ControleOnline\Entity\Status
0 ignored issues
show
Bug introduced by
The type ControleOnline\Entity\Status 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...
77
     *
78
     * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\Status")
79
     * @ORM\JoinColumns({
80
     *   @ORM\JoinColumn(name="status_id", referencedColumnName="id")
81
     * })
82
     * @Groups({"contract_read"})
83
     */
84
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['status' => 'exact'])]
85
86
    private $status;
87
    //, columnDefinition="enum('Active', 'Canceled', 'Amended')"
88
    /**
89
     * @ORM\Column(name="doc_key", type="string")
90
     * @Groups({"contract_read"})
91
     */
92
    private $doc_key;
93
    /**
94
     * @ORM\Column(name="start_date", type="datetime",  nullable=false)
95
     * @Groups({"contract_read"})
96
     */
97
    private $startDate;
98
    /**
99
     * @ORM\Column(name="end_date", type="datetime",  nullable=false)
100
     * @Groups({"contract_read"})
101
     */
102
    private $endDate;
103
    /**
104
     * @ORM\Column(name="creation_date", type="datetime",  nullable=false)
105
     * @Groups({"contract_read"})
106
     */
107
    private $creationDate;
108
    /**
109
     * @ORM\Column(name="alter_date", type="datetime",  nullable=false)
110
     * @Groups({"contract_read"})
111
     */
112
    private $alterDate;
113
    /**
114
     * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\Contract")
115
     * @ORM\JoinColumns({
116
     *   @ORM\JoinColumn(name="contract_parent_id", referencedColumnName="id", nullable=true)
117
     * })
118
     * @Groups({"contract_read"})
119
     */
120
    private $contractParent;
121
    /**
122
     * Many Contracts have Many Peoples.
123
     *
124
     * @ORM\ManyToMany(targetEntity="ControleOnline\Entity\People")
125
     * @ORM\JoinTable(name="contract_people",
126
     *      joinColumns={@ORM\JoinColumn(name="contract_id", referencedColumnName="id")},
127
     *      inverseJoinColumns={@ORM\JoinColumn(name="people_id", referencedColumnName="id")}
128
     *      )
129
     * @Groups({"contract_read"})
130
     */
131
    private $peoples;
132
133
134
    public function __construct()
135
    {
136
        $this->startDate = new DateTime('now');
137
        $this->endDate = new DateTime('now');
138
        $this->creationDate = new DateTime('now');
139
        $this->alterDate = new DateTime('now');
140
    }
141
    public function getId(): int
142
    {
143
        return $this->id;
144
    }
145
    public function getModel(): Model
0 ignored issues
show
Bug introduced by
The type ControleOnline\Entity\Model 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
        return $this->contractModel;
148
    }
149
    public function setModel(Model $document_model): Contract
150
    {
151
        $this->contractModel = $document_model;
152
        return $this;
153
    }
154
    public function getKey(): ?string
155
    {
156
        return $this->doc_key;
157
    }
158
    public function setKey(string $doc_key): Contract
159
    {
160
        $this->doc_key = $doc_key;
161
        return $this;
162
    }
163
164
    /**
165
     * Set status
166
     *
167
     * @param \ControleOnline\Entity\Status $status
168
     * @return Order
0 ignored issues
show
Bug introduced by
The type ControleOnline\Entity\Order 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...
169
     */
170
    public function setStatus(\ControleOnline\Entity\Status $status = null)
171
    {
172
        $this->status = $status;
173
174
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type ControleOnline\Entity\Contract which is incompatible with the documented return type ControleOnline\Entity\Order.
Loading history...
175
    }
176
177
    /**
178
     * Get status
179
     *
180
     * @return \ControleOnline\Entity\Status
181
     */
182
    public function getStatus()
183
    {
184
        return $this->status;
185
    }
186
187
    public function getStartDate(): DateTime
188
    {
189
        return $this->startDate;
190
    }
191
    public function setStartDate(DateTime $start_date): Contract
192
    {
193
        $this->startDate = $start_date;
194
        return $this;
195
    }
196
    public function getEndDate(): ?DateTime
197
    {
198
        return $this->endDate;
199
    }
200
    public function setEndDate(DateTime $end_date): Contract
201
    {
202
        $this->endDate = $end_date;
203
        return $this;
204
    }
205
    public function getCreationDate(): DateTime
206
    {
207
        return $this->creationDate;
208
    }
209
    public function setCreationDate(DateTime $creation_date): Contract
210
    {
211
        $this->creationDate = $creation_date;
212
        return $this;
213
    }
214
    public function getAlterDate(): DateTime
215
    {
216
        return $this->alterDate;
217
    }
218
    public function setAlterDate(DateTime $alter_date): Contract
219
    {
220
        $this->alterDate = $alter_date;
221
        return $this;
222
    }
223
    /**
224
     * @return mixed
225
     */
226
    public function getContractParent()
227
    {
228
        return $this->contractParent;
229
    }
230
    public function setContractParentId(Contract $contractParent): Contract
231
    {
232
        $this->contractParent = $contractParent;
233
        return $this;
234
    }
235
    public function getPeoples(): Collection
236
    {
237
        return $this->peoples;
238
    }
239
240
    /**
241
     * Get })
242
     */
243
    public function getContractFile()
244
    {
245
        return $this->contractFile;
246
    }
247
248
    /**
249
     * Set })
250
     */
251
    public function setContractFile($contractFile): self
252
    {
253
        $this->contractFile = $contractFile;
254
255
        return $this;
256
    }
257
}
258