|
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\Organization; |
|
24
|
|
|
use Doctrine\Common\Collections\Collection; |
|
25
|
|
|
use Gedmo\Mapping\Annotation as Gedmo; |
|
26
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* @Gedmo\Tree(type="nested") |
|
30
|
|
|
* @ORM\Entity(repositoryClass="AppBundle\Repository\Documentation\FolderRepository") |
|
31
|
|
|
* @ORM\Table(name="documentation_folder", indexes={@ORM\Index(columns={"lft"}), @ORM\Index(columns={"rght"})})) |
|
32
|
|
|
*/ |
|
33
|
|
|
class Folder |
|
34
|
|
|
{ |
|
35
|
|
|
const VISIBILITY_NO_RESTRICTION = 0; |
|
36
|
|
|
const VISIBILITY_OWN_USER = 1; |
|
37
|
|
|
const VISIBILITY_OWN_PROFILE = 2; |
|
38
|
|
|
|
|
39
|
|
|
const GROUP_BY_NONE = 0; |
|
40
|
|
|
const GROUP_BY_USER = 1; |
|
41
|
|
|
const GROUP_BY_PROFILE = 2; |
|
42
|
|
|
|
|
43
|
|
|
const TYPE_NORMAL = 0; |
|
44
|
|
|
const TYPE_WORKFLOW = 1; |
|
45
|
|
|
const TYPE_TASKS = 2; |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* @ORM\Id() |
|
49
|
|
|
* @ORM\GeneratedValue(strategy="AUTO") |
|
50
|
|
|
* @ORM\Column(type="integer") |
|
51
|
|
|
* @var int |
|
52
|
|
|
*/ |
|
53
|
|
|
private $id; |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* @ORM\Column(type="string") |
|
57
|
|
|
* @var string |
|
58
|
|
|
*/ |
|
59
|
|
|
private $name; |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* @ORM\Column(type="text", nullable=true) |
|
63
|
|
|
* @var string |
|
64
|
|
|
*/ |
|
65
|
|
|
private $description; |
|
66
|
|
|
|
|
67
|
|
|
/** |
|
68
|
|
|
* @Gedmo\TreeLeft |
|
69
|
|
|
* @ORM\Column(name="lft", type="integer") |
|
70
|
|
|
* @var int |
|
71
|
|
|
*/ |
|
72
|
|
|
private $left; |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* @Gedmo\TreeLevel |
|
76
|
|
|
* @ORM\Column(name="lvl", type="integer") |
|
77
|
|
|
* @var int |
|
78
|
|
|
*/ |
|
79
|
|
|
private $level; |
|
80
|
|
|
|
|
81
|
|
|
/** |
|
82
|
|
|
* @Gedmo\TreeRight |
|
83
|
|
|
* @ORM\Column(name="rght", type="integer") |
|
84
|
|
|
* @var int |
|
85
|
|
|
*/ |
|
86
|
|
|
private $right; |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* @Gedmo\TreeParent() |
|
90
|
|
|
* @ORM\ManyToOne(targetEntity="Folder", inversedBy="children") |
|
91
|
|
|
* @ORM\JoinColumn(onDelete="CASCADE", nullable=true) |
|
92
|
|
|
* @var Folder |
|
93
|
|
|
*/ |
|
94
|
|
|
private $parent; |
|
95
|
|
|
|
|
96
|
|
|
/** |
|
97
|
|
|
* @ORM\OneToMany(targetEntity="Folder", mappedBy="parent") |
|
98
|
|
|
* @var Collection |
|
99
|
|
|
*/ |
|
100
|
|
|
private $children; |
|
101
|
|
|
|
|
102
|
|
|
/** |
|
103
|
|
|
* @Gedmo\TreeRoot |
|
104
|
|
|
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\Organization") |
|
105
|
|
|
* @ORM\JoinColumn(nullable=false, onDelete="CASCADE") |
|
106
|
|
|
* @var Organization |
|
107
|
|
|
*/ |
|
108
|
|
|
private $organization; |
|
109
|
|
|
|
|
110
|
|
|
/** |
|
111
|
|
|
* @ORM\OneToMany(targetEntity="FolderPermission", mappedBy="folder") |
|
112
|
|
|
* @var Collection |
|
113
|
|
|
*/ |
|
114
|
|
|
private $permissions; |
|
115
|
|
|
|
|
116
|
|
|
/** |
|
117
|
|
|
* @ORM\Column(type="integer") |
|
118
|
|
|
* @var int |
|
119
|
|
|
*/ |
|
120
|
|
|
private $type; |
|
121
|
|
|
|
|
122
|
|
|
/** |
|
123
|
|
|
* @ORM\Column(type="boolean") |
|
124
|
|
|
* @var bool |
|
125
|
|
|
*/ |
|
126
|
|
|
private $versionShown; |
|
127
|
|
|
|
|
128
|
|
|
/** |
|
129
|
|
|
* @ORM\Column(type="boolean") |
|
130
|
|
|
* @var bool |
|
131
|
|
|
*/ |
|
132
|
|
|
private $public; |
|
133
|
|
|
|
|
134
|
|
|
/** |
|
135
|
|
|
* @ORM\Column(type="string", nullable=true) |
|
136
|
|
|
* @var string |
|
137
|
|
|
*/ |
|
138
|
|
|
private $publicToken; |
|
139
|
|
|
|
|
140
|
|
|
/** |
|
141
|
|
|
* @ORM\OneToMany(targetEntity="Entry", mappedBy="folder") |
|
142
|
|
|
* @var Collection |
|
143
|
|
|
*/ |
|
144
|
|
|
private $entries; |
|
145
|
|
|
|
|
146
|
|
|
/** |
|
147
|
|
|
* @ORM\OneToMany(targetEntity="Task", mappedBy="folder") |
|
148
|
|
|
* @var Collection |
|
149
|
|
|
*/ |
|
150
|
|
|
private $tasks; |
|
151
|
|
|
|
|
152
|
|
|
/** |
|
153
|
|
|
* @ORM\Column(type="integer") |
|
154
|
|
|
* @var int |
|
155
|
|
|
*/ |
|
156
|
|
|
private $visibility; |
|
157
|
|
|
|
|
158
|
|
|
/** |
|
159
|
|
|
* @ORM\Column(type="integer") |
|
160
|
|
|
* @var int |
|
161
|
|
|
*/ |
|
162
|
|
|
private $groupBy; |
|
163
|
|
|
|
|
164
|
|
|
/** |
|
165
|
|
|
* @ORM\Column(type="boolean") |
|
166
|
|
|
* @var bool |
|
167
|
|
|
*/ |
|
168
|
|
|
private $autoArchive; |
|
169
|
|
|
|
|
170
|
|
|
/** |
|
171
|
|
|
* Constructor |
|
172
|
|
|
*/ |
|
173
|
|
|
public function __construct() |
|
174
|
|
|
{ |
|
175
|
|
|
$this->children = new \Doctrine\Common\Collections\ArrayCollection(); |
|
176
|
|
|
$this->entries = new \Doctrine\Common\Collections\ArrayCollection(); |
|
177
|
|
|
$this->tasks = new \Doctrine\Common\Collections\ArrayCollection(); |
|
178
|
|
|
$this->permissions = new \Doctrine\Common\Collections\ArrayCollection(); |
|
179
|
|
|
|
|
180
|
|
|
$this->versionShown = true; |
|
181
|
|
|
$this->public = false; |
|
182
|
|
|
$this->autoArchive = false; |
|
183
|
|
|
$this->type = $this::TYPE_NORMAL; |
|
184
|
|
|
$this->visibility = $this::VISIBILITY_NO_RESTRICTION; |
|
185
|
|
|
$this->groupBy = $this::GROUP_BY_NONE; |
|
186
|
|
|
} |
|
187
|
|
|
|
|
188
|
|
|
/** |
|
189
|
|
|
* Converts entity to string |
|
190
|
|
|
* |
|
191
|
|
|
* @return string |
|
192
|
|
|
*/ |
|
193
|
|
|
public function __toString() |
|
194
|
|
|
{ |
|
195
|
|
|
return $this->getName(); |
|
196
|
|
|
} |
|
197
|
|
|
|
|
198
|
|
|
/** |
|
199
|
|
|
* Get element path |
|
200
|
|
|
* |
|
201
|
|
|
* @return string |
|
202
|
|
|
*/ |
|
203
|
|
View Code Duplication |
public function getPath() |
|
|
|
|
|
|
204
|
|
|
{ |
|
205
|
|
|
$path = ''; |
|
206
|
|
|
$item = $this; |
|
207
|
|
|
$first = true; |
|
208
|
|
|
|
|
209
|
|
|
while ($item) { |
|
210
|
|
|
$path = $item->getName().($first ? '' : '/').$path; |
|
211
|
|
|
$first = false; |
|
212
|
|
|
$item = $item->getParent(); |
|
213
|
|
|
} |
|
214
|
|
|
|
|
215
|
|
|
return $path; |
|
216
|
|
|
} |
|
217
|
|
|
|
|
218
|
|
|
/** |
|
219
|
|
|
* Get element path array from specified root |
|
220
|
|
|
* |
|
221
|
|
|
* @param Folder|null $root |
|
222
|
|
|
* |
|
223
|
|
|
* @return Folder[] |
|
224
|
|
|
*/ |
|
225
|
|
View Code Duplication |
public function getPathArray(Folder $root = null) |
|
|
|
|
|
|
226
|
|
|
{ |
|
227
|
|
|
$path = []; |
|
228
|
|
|
$item = $this; |
|
229
|
|
|
|
|
230
|
|
|
while ($item && $item !== $root) { |
|
231
|
|
|
array_unshift($path, $item); |
|
232
|
|
|
$item = $item->getParent(); |
|
233
|
|
|
} |
|
234
|
|
|
return $path; |
|
235
|
|
|
} |
|
236
|
|
|
|
|
237
|
|
|
/** |
|
238
|
|
|
* Get id |
|
239
|
|
|
* |
|
240
|
|
|
* @return integer |
|
241
|
|
|
*/ |
|
242
|
|
|
public function getId() |
|
243
|
|
|
{ |
|
244
|
|
|
return $this->id; |
|
245
|
|
|
} |
|
246
|
|
|
|
|
247
|
|
|
/** |
|
248
|
|
|
* Set name |
|
249
|
|
|
* |
|
250
|
|
|
* @param string $name |
|
251
|
|
|
* |
|
252
|
|
|
* @return Folder |
|
253
|
|
|
*/ |
|
254
|
|
|
public function setName($name) |
|
255
|
|
|
{ |
|
256
|
|
|
$this->name = $name; |
|
257
|
|
|
|
|
258
|
|
|
return $this; |
|
259
|
|
|
} |
|
260
|
|
|
|
|
261
|
|
|
/** |
|
262
|
|
|
* Get name |
|
263
|
|
|
* |
|
264
|
|
|
* @return string |
|
265
|
|
|
*/ |
|
266
|
|
|
public function getName() |
|
267
|
|
|
{ |
|
268
|
|
|
return $this->name; |
|
269
|
|
|
} |
|
270
|
|
|
|
|
271
|
|
|
/** |
|
272
|
|
|
* Set left |
|
273
|
|
|
* |
|
274
|
|
|
* @param integer $left |
|
275
|
|
|
* |
|
276
|
|
|
* @return Folder |
|
277
|
|
|
*/ |
|
278
|
|
|
public function setLeft($left) |
|
279
|
|
|
{ |
|
280
|
|
|
$this->left = $left; |
|
281
|
|
|
|
|
282
|
|
|
return $this; |
|
283
|
|
|
} |
|
284
|
|
|
|
|
285
|
|
|
/** |
|
286
|
|
|
* Get left |
|
287
|
|
|
* |
|
288
|
|
|
* @return integer |
|
289
|
|
|
*/ |
|
290
|
|
|
public function getLeft() |
|
291
|
|
|
{ |
|
292
|
|
|
return $this->left; |
|
293
|
|
|
} |
|
294
|
|
|
|
|
295
|
|
|
/** |
|
296
|
|
|
* Set level |
|
297
|
|
|
* |
|
298
|
|
|
* @param integer $level |
|
299
|
|
|
* |
|
300
|
|
|
* @return Folder |
|
301
|
|
|
*/ |
|
302
|
|
|
public function setLevel($level) |
|
303
|
|
|
{ |
|
304
|
|
|
$this->level = $level; |
|
305
|
|
|
|
|
306
|
|
|
return $this; |
|
307
|
|
|
} |
|
308
|
|
|
|
|
309
|
|
|
/** |
|
310
|
|
|
* Get level |
|
311
|
|
|
* |
|
312
|
|
|
* @return integer |
|
313
|
|
|
*/ |
|
314
|
|
|
public function getLevel() |
|
315
|
|
|
{ |
|
316
|
|
|
return $this->level; |
|
317
|
|
|
} |
|
318
|
|
|
|
|
319
|
|
|
/** |
|
320
|
|
|
* Set right |
|
321
|
|
|
* |
|
322
|
|
|
* @param integer $right |
|
323
|
|
|
* |
|
324
|
|
|
* @return Folder |
|
325
|
|
|
*/ |
|
326
|
|
|
public function setRight($right) |
|
327
|
|
|
{ |
|
328
|
|
|
$this->right = $right; |
|
329
|
|
|
|
|
330
|
|
|
return $this; |
|
331
|
|
|
} |
|
332
|
|
|
|
|
333
|
|
|
/** |
|
334
|
|
|
* Get right |
|
335
|
|
|
* |
|
336
|
|
|
* @return integer |
|
337
|
|
|
*/ |
|
338
|
|
|
public function getRight() |
|
339
|
|
|
{ |
|
340
|
|
|
return $this->right; |
|
341
|
|
|
} |
|
342
|
|
|
|
|
343
|
|
|
/** |
|
344
|
|
|
* Set parent |
|
345
|
|
|
* |
|
346
|
|
|
* @param Folder $parent |
|
347
|
|
|
* |
|
348
|
|
|
* @return Folder |
|
349
|
|
|
*/ |
|
350
|
|
|
public function setParent(Folder $parent = null) |
|
351
|
|
|
{ |
|
352
|
|
|
$this->parent = $parent; |
|
353
|
|
|
|
|
354
|
|
|
return $this; |
|
355
|
|
|
} |
|
356
|
|
|
|
|
357
|
|
|
/** |
|
358
|
|
|
* Get parent |
|
359
|
|
|
* |
|
360
|
|
|
* @return Folder |
|
361
|
|
|
*/ |
|
362
|
|
|
public function getParent() |
|
363
|
|
|
{ |
|
364
|
|
|
return $this->parent; |
|
365
|
|
|
} |
|
366
|
|
|
|
|
367
|
|
|
/** |
|
368
|
|
|
* Add child |
|
369
|
|
|
* |
|
370
|
|
|
* @param Folder $child |
|
371
|
|
|
* |
|
372
|
|
|
* @return Folder |
|
373
|
|
|
*/ |
|
374
|
|
|
public function addChild(Folder $child) |
|
375
|
|
|
{ |
|
376
|
|
|
$this->children[] = $child; |
|
377
|
|
|
|
|
378
|
|
|
return $this; |
|
379
|
|
|
} |
|
380
|
|
|
|
|
381
|
|
|
/** |
|
382
|
|
|
* Remove child |
|
383
|
|
|
* |
|
384
|
|
|
* @param Folder $child |
|
385
|
|
|
*/ |
|
386
|
|
|
public function removeChild(Folder $child) |
|
387
|
|
|
{ |
|
388
|
|
|
$this->children->removeElement($child); |
|
389
|
|
|
} |
|
390
|
|
|
|
|
391
|
|
|
/** |
|
392
|
|
|
* Get children |
|
393
|
|
|
* |
|
394
|
|
|
* @return Collection |
|
395
|
|
|
*/ |
|
396
|
|
|
public function getChildren() |
|
397
|
|
|
{ |
|
398
|
|
|
return $this->children; |
|
399
|
|
|
} |
|
400
|
|
|
|
|
401
|
|
|
/** |
|
402
|
|
|
* Set description |
|
403
|
|
|
* |
|
404
|
|
|
* @param string $description |
|
405
|
|
|
* |
|
406
|
|
|
* @return Folder |
|
407
|
|
|
*/ |
|
408
|
|
|
public function setDescription($description) |
|
409
|
|
|
{ |
|
410
|
|
|
$this->description = $description; |
|
411
|
|
|
|
|
412
|
|
|
return $this; |
|
413
|
|
|
} |
|
414
|
|
|
|
|
415
|
|
|
/** |
|
416
|
|
|
* Get description |
|
417
|
|
|
* |
|
418
|
|
|
* @return string |
|
419
|
|
|
*/ |
|
420
|
|
|
public function getDescription() |
|
421
|
|
|
{ |
|
422
|
|
|
return $this->description; |
|
423
|
|
|
} |
|
424
|
|
|
|
|
425
|
|
|
/** |
|
426
|
|
|
* Set organization |
|
427
|
|
|
* |
|
428
|
|
|
* @param Organization $organization |
|
429
|
|
|
* |
|
430
|
|
|
* @return Folder |
|
431
|
|
|
*/ |
|
432
|
|
|
public function setOrganization(Organization $organization) |
|
433
|
|
|
{ |
|
434
|
|
|
$this->organization = $organization; |
|
435
|
|
|
|
|
436
|
|
|
return $this; |
|
437
|
|
|
} |
|
438
|
|
|
|
|
439
|
|
|
/** |
|
440
|
|
|
* Get organization |
|
441
|
|
|
* |
|
442
|
|
|
* @return Organization |
|
443
|
|
|
*/ |
|
444
|
|
|
public function getOrganization() |
|
445
|
|
|
{ |
|
446
|
|
|
return $this->organization; |
|
447
|
|
|
} |
|
448
|
|
|
|
|
449
|
|
|
/** |
|
450
|
|
|
* Add permission |
|
451
|
|
|
* |
|
452
|
|
|
* @param FolderPermission $permission |
|
453
|
|
|
* |
|
454
|
|
|
* @return Folder |
|
455
|
|
|
*/ |
|
456
|
|
|
public function addPermission(FolderPermission $permission) |
|
457
|
|
|
{ |
|
458
|
|
|
$this->permissions[] = $permission; |
|
459
|
|
|
|
|
460
|
|
|
return $this; |
|
461
|
|
|
} |
|
462
|
|
|
|
|
463
|
|
|
/** |
|
464
|
|
|
* Remove permission |
|
465
|
|
|
* |
|
466
|
|
|
* @param FolderPermission $permission |
|
467
|
|
|
*/ |
|
468
|
|
|
public function removePermission(FolderPermission $permission) |
|
469
|
|
|
{ |
|
470
|
|
|
$this->permissions->removeElement($permission); |
|
471
|
|
|
} |
|
472
|
|
|
|
|
473
|
|
|
/** |
|
474
|
|
|
* Get permissions |
|
475
|
|
|
* |
|
476
|
|
|
* @return Collection |
|
477
|
|
|
*/ |
|
478
|
|
|
public function getPermissions() |
|
479
|
|
|
{ |
|
480
|
|
|
return $this->permissions; |
|
481
|
|
|
} |
|
482
|
|
|
|
|
483
|
|
|
/** |
|
484
|
|
|
* Set versionShown |
|
485
|
|
|
* |
|
486
|
|
|
* @param boolean $versionShown |
|
487
|
|
|
* |
|
488
|
|
|
* @return Folder |
|
489
|
|
|
*/ |
|
490
|
|
|
public function setVersionShown($versionShown) |
|
491
|
|
|
{ |
|
492
|
|
|
$this->versionShown = $versionShown; |
|
493
|
|
|
|
|
494
|
|
|
return $this; |
|
495
|
|
|
} |
|
496
|
|
|
|
|
497
|
|
|
/** |
|
498
|
|
|
* Get versionShown |
|
499
|
|
|
* |
|
500
|
|
|
* @return boolean |
|
501
|
|
|
*/ |
|
502
|
|
|
public function isVersionShown() |
|
503
|
|
|
{ |
|
504
|
|
|
return $this->versionShown; |
|
505
|
|
|
} |
|
506
|
|
|
|
|
507
|
|
|
/** |
|
508
|
|
|
* Set public |
|
509
|
|
|
* |
|
510
|
|
|
* @param boolean $public |
|
511
|
|
|
* |
|
512
|
|
|
* @return Folder |
|
513
|
|
|
*/ |
|
514
|
|
|
public function setPublic($public) |
|
515
|
|
|
{ |
|
516
|
|
|
$this->public = $public; |
|
517
|
|
|
|
|
518
|
|
|
return $this; |
|
519
|
|
|
} |
|
520
|
|
|
|
|
521
|
|
|
/** |
|
522
|
|
|
* Get public |
|
523
|
|
|
* |
|
524
|
|
|
* @return boolean |
|
525
|
|
|
*/ |
|
526
|
|
|
public function isPublic() |
|
527
|
|
|
{ |
|
528
|
|
|
return $this->public; |
|
529
|
|
|
} |
|
530
|
|
|
|
|
531
|
|
|
/** |
|
532
|
|
|
* Set publicToken |
|
533
|
|
|
* |
|
534
|
|
|
* @param string $publicToken |
|
535
|
|
|
* |
|
536
|
|
|
* @return Folder |
|
537
|
|
|
*/ |
|
538
|
|
|
public function setPublicToken($publicToken) |
|
539
|
|
|
{ |
|
540
|
|
|
$this->publicToken = $publicToken; |
|
541
|
|
|
|
|
542
|
|
|
return $this; |
|
543
|
|
|
} |
|
544
|
|
|
|
|
545
|
|
|
/** |
|
546
|
|
|
* Get publicToken |
|
547
|
|
|
* |
|
548
|
|
|
* @return string |
|
549
|
|
|
*/ |
|
550
|
|
|
public function getPublicToken() |
|
551
|
|
|
{ |
|
552
|
|
|
return $this->publicToken; |
|
553
|
|
|
} |
|
554
|
|
|
|
|
555
|
|
|
/** |
|
556
|
|
|
* Add entry |
|
557
|
|
|
* |
|
558
|
|
|
* @param Entry $entry |
|
559
|
|
|
* |
|
560
|
|
|
* @return Folder |
|
561
|
|
|
*/ |
|
562
|
|
|
public function addEntry(Entry $entry) |
|
563
|
|
|
{ |
|
564
|
|
|
$this->entries[] = $entry; |
|
565
|
|
|
|
|
566
|
|
|
return $this; |
|
567
|
|
|
} |
|
568
|
|
|
|
|
569
|
|
|
/** |
|
570
|
|
|
* Remove entry |
|
571
|
|
|
* |
|
572
|
|
|
* @param Entry $entry |
|
573
|
|
|
*/ |
|
574
|
|
|
public function removeEntry(Entry $entry) |
|
575
|
|
|
{ |
|
576
|
|
|
$this->entries->removeElement($entry); |
|
577
|
|
|
} |
|
578
|
|
|
|
|
579
|
|
|
/** |
|
580
|
|
|
* Get entries |
|
581
|
|
|
* |
|
582
|
|
|
* @return Collection |
|
583
|
|
|
*/ |
|
584
|
|
|
public function getEntries() |
|
585
|
|
|
{ |
|
586
|
|
|
return $this->entries; |
|
587
|
|
|
} |
|
588
|
|
|
|
|
589
|
|
|
/** |
|
590
|
|
|
* Set visibility |
|
591
|
|
|
* |
|
592
|
|
|
* @param integer $visibility |
|
593
|
|
|
* |
|
594
|
|
|
* @return Folder |
|
595
|
|
|
*/ |
|
596
|
|
|
public function setVisibility($visibility) |
|
597
|
|
|
{ |
|
598
|
|
|
$this->visibility = $visibility; |
|
599
|
|
|
|
|
600
|
|
|
return $this; |
|
601
|
|
|
} |
|
602
|
|
|
|
|
603
|
|
|
/** |
|
604
|
|
|
* Get visibility |
|
605
|
|
|
* |
|
606
|
|
|
* @return integer |
|
607
|
|
|
*/ |
|
608
|
|
|
public function getVisibility() |
|
609
|
|
|
{ |
|
610
|
|
|
return $this->visibility; |
|
611
|
|
|
} |
|
612
|
|
|
|
|
613
|
|
|
/** |
|
614
|
|
|
* Set groupBy |
|
615
|
|
|
* |
|
616
|
|
|
* @param integer $groupBy |
|
617
|
|
|
* |
|
618
|
|
|
* @return Folder |
|
619
|
|
|
*/ |
|
620
|
|
|
public function setGroupBy($groupBy) |
|
621
|
|
|
{ |
|
622
|
|
|
$this->groupBy = $groupBy; |
|
623
|
|
|
|
|
624
|
|
|
return $this; |
|
625
|
|
|
} |
|
626
|
|
|
|
|
627
|
|
|
/** |
|
628
|
|
|
* Get groupBy |
|
629
|
|
|
* |
|
630
|
|
|
* @return integer |
|
631
|
|
|
*/ |
|
632
|
|
|
public function getGroupBy() |
|
633
|
|
|
{ |
|
634
|
|
|
return $this->groupBy; |
|
635
|
|
|
} |
|
636
|
|
|
|
|
637
|
|
|
/** |
|
638
|
|
|
* Set type |
|
639
|
|
|
* |
|
640
|
|
|
* @param integer $type |
|
641
|
|
|
* |
|
642
|
|
|
* @return Folder |
|
643
|
|
|
*/ |
|
644
|
|
|
public function setType($type) |
|
645
|
|
|
{ |
|
646
|
|
|
$this->type = $type; |
|
647
|
|
|
|
|
648
|
|
|
return $this; |
|
649
|
|
|
} |
|
650
|
|
|
|
|
651
|
|
|
/** |
|
652
|
|
|
* Get type |
|
653
|
|
|
* |
|
654
|
|
|
* @return integer |
|
655
|
|
|
*/ |
|
656
|
|
|
public function getType() |
|
657
|
|
|
{ |
|
658
|
|
|
return $this->type; |
|
659
|
|
|
} |
|
660
|
|
|
|
|
661
|
|
|
/** |
|
662
|
|
|
* Add task |
|
663
|
|
|
* |
|
664
|
|
|
* @param Task $task |
|
665
|
|
|
* |
|
666
|
|
|
* @return Folder |
|
667
|
|
|
*/ |
|
668
|
|
|
public function addTask(Task $task) |
|
669
|
|
|
{ |
|
670
|
|
|
$this->tasks[] = $task; |
|
671
|
|
|
|
|
672
|
|
|
return $this; |
|
673
|
|
|
} |
|
674
|
|
|
|
|
675
|
|
|
/** |
|
676
|
|
|
* Remove task |
|
677
|
|
|
* |
|
678
|
|
|
* @param Task $task |
|
679
|
|
|
*/ |
|
680
|
|
|
public function removeTask(Task $task) |
|
681
|
|
|
{ |
|
682
|
|
|
$this->tasks->removeElement($task); |
|
683
|
|
|
} |
|
684
|
|
|
|
|
685
|
|
|
/** |
|
686
|
|
|
* Get tasks |
|
687
|
|
|
* |
|
688
|
|
|
* @return Collection |
|
689
|
|
|
*/ |
|
690
|
|
|
public function getTasks() |
|
691
|
|
|
{ |
|
692
|
|
|
return $this->tasks; |
|
693
|
|
|
} |
|
694
|
|
|
|
|
695
|
|
|
/** |
|
696
|
|
|
* @return bool |
|
697
|
|
|
*/ |
|
698
|
|
|
public function isAutoArchive() |
|
699
|
|
|
{ |
|
700
|
|
|
return $this->autoArchive; |
|
701
|
|
|
} |
|
702
|
|
|
|
|
703
|
|
|
/** |
|
704
|
|
|
* @param bool $autoArchive |
|
705
|
|
|
* |
|
706
|
|
|
* @return Folder |
|
707
|
|
|
*/ |
|
708
|
|
|
public function setAutoArchive($autoArchive) |
|
709
|
|
|
{ |
|
710
|
|
|
$this->autoArchive = $autoArchive; |
|
711
|
|
|
return $this; |
|
712
|
|
|
} |
|
713
|
|
|
|
|
714
|
|
|
} |
|
715
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.