Completed
Push — master ( 6064a2...7a17c2 )
by Luis Ramón
02:25
created

Task::getDocumentNameTemplate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/*
3
  ÁTICA - Aplicación web para la gestión documental de centros educativos
4
5
  Copyright (C) 2015-2017: Luis Ramón López López
6
7
  This program is free software: you can redistribute it and/or modify
8
  it under the terms of the GNU Affero General Public License as published by
9
  the Free Software Foundation, either version 3 of the License, or
10
  (at your option) any later version.
11
12
  This program is distributed in the hope that it will be useful,
13
  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
  GNU Affero General Public License for more details.
16
17
  You should have received a copy of the GNU Affero General Public License
18
  along with this program.  If not, see [http://www.gnu.org/licenses/].
19
*/
20
21
namespace AppBundle\Entity\Documentation;
22
23
use AppBundle\Entity\Element;
24
use AppBundle\Entity\Periodicity;
25
use AppBundle\Entity\Traits\UserBlameableTrait;
26
use Doctrine\Common\Collections\ArrayCollection;
27
use Doctrine\Common\Collections\Collection;
28
use Doctrine\ORM\Mapping as ORM;
29
use Gedmo\Timestampable\Traits\TimestampableEntity;
30
31
/**
32
 * @ORM\Entity()
33
 * @ORM\Table(name="documentation_task")
34
 */
35
class Task
36
{
37
    use TimestampableEntity;
38
    use UserBlameableTrait;
39
40
    const TASK_DELIVERY_BY_PROFILE = 0;
41
    const TASK_DELIVERY_BY_USER = 1;
42
43
    /**
44
     * @ORM\Id()
45
     * @ORM\GeneratedValue(strategy="AUTO")
46
     * @ORM\Column(type="integer")
47
     * @var int
48
     */
49
    private $id;
50
51
    /**
52
     * @ORM\Column(type="string")
53
     * @var string
54
     */
55
    private $name;
56
57
    /**
58
     * @ORM\Column(type="text", nullable=true)
59
     * @var string
60
     */
61
    private $description;
62
63
    /**
64
     * @ORM\ManyToOne(targetEntity="Folder", inversedBy="tasks")
65
     * @ORM\JoinColumn(nullable=false)
66
     * @var Folder
67
     */
68
    private $folder;
69
70
    /**
71
     * @ORM\Column(type="datetime", nullable=true)
72
     * @var \DateTime
73
     */
74
    private $toDate;
75
76
    /**
77
     * @ORM\Column(type="datetime", nullable=true)
78
     * @var \DateTime
79
     */
80
    private $fromDate;
81
82
    /**
83
     * @ORM\Column(type="integer")
84
     * @var int
85
     */
86
    private $gracePeriod;
87
88
    /**
89
     * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Periodicity")
90
     * @ORM\JoinColumn(nullable=true)
91
     * @var Periodicity
92
     */
93
    private $periodicity;
94
95
    /**
96
     * @ORM\OneToMany(targetEntity="TaskPermission", mappedBy="task")
97
     * @var Collection
98
     */
99
    private $permissions;
100
101
    /**
102
     * @ORM\ManyToMany(targetEntity="AppBundle\Entity\Element")
103
     * @ORM\JoinTable(name="documentation_task_label")
104
     * @var Collection
105
     */
106
    private $labels;
107
108
    /**
109
     * @ORM\ManyToMany(targetEntity="Entry")
110
     * @ORM\JoinTable(name="documentation_task_entries")
111
     * @var Collection
112
     */
113
    private $relatedEntries;
114
115
    /**
116
     * @ORM\Column(type="string", nullable=true)
117
     * @var string
118
     */
119
    private $documentNameTemplate;
120
121
    /**
122
     * @ORM\Column(type="integer")
123
     * @var int
124
     */
125
    private $deliveryType;
126
127
    /**
128
     * Task constructor.
129
     */
130
    public function __construct()
131
    {
132
        $this->permissions = new ArrayCollection();
133
        $this->labels = new ArrayCollection();
134
        $this->relatedEntries = new ArrayCollection();
135
136
        $this->gracePeriod = 0;
137
        $this->deliveryType = self::TASK_DELIVERY_BY_PROFILE;
138
    }
139
140
    /**
141
     * Get id
142
     *
143
     * @return integer
144
     */
145
    public function getId()
146
    {
147
        return $this->id;
148
    }
149
150
    /**
151
     * Set name
152
     *
153
     * @param string $name
154
     *
155
     * @return Task
156
     */
157
    public function setName($name)
158
    {
159
        $this->name = $name;
160
161
        return $this;
162
    }
163
164
    /**
165
     * Get name
166
     *
167
     * @return string
168
     */
169
    public function getName()
170
    {
171
        return $this->name;
172
    }
173
174
    /**
175
     * Set description
176
     *
177
     * @param string $description
178
     *
179
     * @return Task
180
     */
181
    public function setDescription($description)
182
    {
183
        $this->description = $description;
184
185
        return $this;
186
    }
187
188
    /**
189
     * Get description
190
     *
191
     * @return string
192
     */
193
    public function getDescription()
194
    {
195
        return $this->description;
196
    }
197
198
    /**
199
     * Set toDate
200
     *
201
     * @param \DateTime $toDate
202
     *
203
     * @return Task
204
     */
205
    public function setToDate($toDate)
206
    {
207
        $this->toDate = $toDate;
208
209
        return $this;
210
    }
211
212
    /**
213
     * Get toDate
214
     *
215
     * @return \DateTime
216
     */
217
    public function getToDate()
218
    {
219
        return $this->toDate;
220
    }
221
222
    /**
223
     * Set fromDate
224
     *
225
     * @param \DateTime $fromDate
226
     *
227
     * @return Task
228
     */
229
    public function setFromDate($fromDate)
230
    {
231
        $this->fromDate = $fromDate;
232
233
        return $this;
234
    }
235
236
    /**
237
     * Get fromDate
238
     *
239
     * @return \DateTime
240
     */
241
    public function getFromDate()
242
    {
243
        return $this->fromDate;
244
    }
245
246
    /**
247
     * Set gracePeriod
248
     *
249
     * @param integer $gracePeriod
250
     *
251
     * @return Task
252
     */
253
    public function setGracePeriod($gracePeriod)
254
    {
255
        $this->gracePeriod = $gracePeriod;
256
257
        return $this;
258
    }
259
260
    /**
261
     * Get gracePeriod
262
     *
263
     * @return integer
264
     */
265
    public function getGracePeriod()
266
    {
267
        return $this->gracePeriod;
268
    }
269
270
    /**
271
     * Set documentNameTemplate
272
     *
273
     * @param string $documentNameTemplate
274
     *
275
     * @return Task
276
     */
277
    public function setDocumentNameTemplate($documentNameTemplate)
278
    {
279
        $this->documentNameTemplate = $documentNameTemplate;
280
281
        return $this;
282
    }
283
284
    /**
285
     * Get documentNameTemplate
286
     *
287
     * @return string
288
     */
289
    public function getDocumentNameTemplate()
290
    {
291
        return $this->documentNameTemplate;
292
    }
293
294
    /**
295
     * Set deliveryType
296
     *
297
     * @param integer $deliveryType
298
     *
299
     * @return Task
300
     */
301
    public function setDeliveryType($deliveryType)
302
    {
303
        $this->deliveryType = $deliveryType;
304
305
        return $this;
306
    }
307
308
    /**
309
     * Get deliveryType
310
     *
311
     * @return integer
312
     */
313
    public function getDeliveryType()
314
    {
315
        return $this->deliveryType;
316
    }
317
318
    /**
319
     * Set folder
320
     *
321
     * @param Folder $folder
322
     *
323
     * @return Task
324
     */
325
    public function setFolder(Folder $folder)
326
    {
327
        $this->folder = $folder;
328
329
        return $this;
330
    }
331
332
    /**
333
     * Get folder
334
     *
335
     * @return Folder
336
     */
337
    public function getFolder()
338
    {
339
        return $this->folder;
340
    }
341
342
    /**
343
     * Set periodicity
344
     *
345
     * @param Periodicity $periodicity
346
     *
347
     * @return Task
348
     */
349
    public function setPeriodicity(Periodicity $periodicity = null)
350
    {
351
        $this->periodicity = $periodicity;
352
353
        return $this;
354
    }
355
356
    /**
357
     * Get periodicity
358
     *
359
     * @return Periodicity
360
     */
361
    public function getPeriodicity()
362
    {
363
        return $this->periodicity;
364
    }
365
366
    /**
367
     * Add label
368
     *
369
     * @param Element $label
370
     *
371
     * @return Task
372
     */
373
    public function addLabel(Element $label)
374
    {
375
        $this->labels[] = $label;
376
377
        return $this;
378
    }
379
380
    /**
381
     * Remove label
382
     *
383
     * @param Element $label
384
     */
385
    public function removeLabel(Element $label)
386
    {
387
        $this->labels->removeElement($label);
388
    }
389
390
    /**
391
     * Get labels
392
     *
393
     * @return Collection
394
     */
395
    public function getLabels()
396
    {
397
        return $this->labels;
398
    }
399
400
    /**
401
     * Add relatedEntry
402
     *
403
     * @param Entry $relatedEntry
404
     *
405
     * @return Task
406
     */
407
    public function addRelatedEntry(Entry $relatedEntry)
408
    {
409
        $this->relatedEntries[] = $relatedEntry;
410
411
        return $this;
412
    }
413
414
    /**
415
     * Remove relatedEntry
416
     *
417
     * @param Entry $relatedEntry
418
     */
419
    public function removeRelatedEntry(Entry $relatedEntry)
420
    {
421
        $this->relatedEntries->removeElement($relatedEntry);
422
    }
423
424
    /**
425
     * Get relatedEntries
426
     *
427
     * @return Collection
428
     */
429
    public function getRelatedEntries()
430
    {
431
        return $this->relatedEntries;
432
    }
433
434
    /**
435
     * Add permission
436
     *
437
     * @param TaskPermission $permission
438
     *
439
     * @return Task
440
     */
441
    public function addPermission(TaskPermission $permission)
442
    {
443
        $this->permissions[] = $permission;
444
445
        return $this;
446
    }
447
448
    /**
449
     * Remove permission
450
     *
451
     * @param TaskPermission $permission
452
     */
453
    public function removePermission(TaskPermission $permission)
454
    {
455
        $this->permissions->removeElement($permission);
456
    }
457
458
    /**
459
     * Get permissions
460
     *
461
     * @return \Doctrine\Common\Collections\Collection
462
     */
463
    public function getPermissions()
464
    {
465
        return $this->permissions;
466
    }
467
}
468