Completed
Push — master ( 2ae089...5f42d6 )
by Luis Ramón
13:38
created

Entry::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 6
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 4
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\HistoricPeriod;
25
use AppBundle\Entity\Traits\UserBlameableTrait;
26
use Doctrine\Common\Collections\Collection;
27
use Gedmo\Mapping\Annotation as Gedmo;
28
use Doctrine\ORM\Mapping as ORM;
29
use Gedmo\Timestampable\Traits\TimestampableEntity;
30
31
/**
32
 * @ORM\Entity(repositoryClass="Gedmo\Sortable\Entity\Repository\SortableRepository")
33
 * @ORM\Table(name="documentation_entry")
34
 */
35
class Entry
36
{
37
    use TimestampableEntity;
38
    use UserBlameableTrait;
39
40
    /**
41
     * @ORM\Id()
42
     * @ORM\GeneratedValue(strategy="AUTO")
43
     * @ORM\Column(type="integer")
44
     * @var int
45
     */
46
    private $id;
47
48
    /**
49
     * @ORM\Column(type="string")
50
     * @var string
51
     */
52
    private $name;
53
54
    /**
55
     * @ORM\Column(type="text", nullable=true)
56
     * @var string
57
     */
58
    private $description;
59
60
    /**
61
     * @Gedmo\SortablePosition()
62
     * @ORM\Column(type="integer")
63
     * @var int
64
     */
65
    private $position;
66
67
    /**
68
     * @Gedmo\SortableGroup()
69
     * @ORM\ManyToOne(targetEntity="Folder", inversedBy="entries")
70
     * @ORM\JoinColumn(nullable=false)
71
     * @var Folder
72
     */
73
    private $folder;
74
75
    /**
76
     * @Gedmo\SortableGroup()
77
     * @ORM\ManyToOne(targetEntity="AppBundle\Entity\HistoricPeriod")
78
     * @ORM\JoinColumn(nullable=true)
79
     * @var HistoricPeriod
80
     */
81
    private $archivedPeriod;
82
83
    /**
84
     * @ORM\ManyToOne(targetEntity="Entry")
85
     * @ORM\JoinColumn(nullable=true)
86
     * @var Entry
87
     */
88
    private $link;
89
90
    /**
91
     * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Element")
92
     * @ORM\JoinColumn(nullable=true)
93
     * @var Element
94
     */
95
    private $element;
96
97
    /**
98
     * @ORM\Column(type="datetime", nullable=true)
99
     * @var \DateTime
100
     */
101
    private $retiredAt;
102
103
    /**
104
     * @ORM\OneToMany(targetEntity="Version", mappedBy="entry")
105
     * @ORM\OrderBy({"versionNr": "DESC"})
106
     * @var Collection
107
     */
108
    private $versions;
109
110
    /**
111
     * @ORM\OneToMany(targetEntity="History", mappedBy="entry")
112
     * @ORM\OrderBy({"createdAt": "ASC"})
113
     * @var Collection
114
     */
115
    private $history;
116
117
    /**
118
     * @ORM\OneToOne(targetEntity="Version")
119
     * @var Version
120
     */
121
    private $currentVersion;
122
123
    /**
124
     * @ORM\Column(type="boolean")
125
     * @var bool
126
     */
127
    private $public;
128
129
    /**
130
     * @ORM\Column(type="string", nullable=true)
131
     * @var string
132
     */
133
    private $publicToken;
134
135
    /**
136
     * Constructor
137
     */
138
    public function __construct()
139
    {
140
        $this->versions = new \Doctrine\Common\Collections\ArrayCollection();
141
        $this->history = new \Doctrine\Common\Collections\ArrayCollection();
142
        $this->public = false;
143
    }
144
145
    /**
146
     * Get id
147
     *
148
     * @return integer
149
     */
150
    public function getId()
151
    {
152
        return $this->id;
153
    }
154
155
    /**
156
     * Set name
157
     *
158
     * @param string $name
159
     *
160
     * @return Entry
161
     */
162
    public function setName($name)
163
    {
164
        $this->name = $name;
165
166
        return $this;
167
    }
168
169
    /**
170
     * Get name
171
     *
172
     * @return string
173
     */
174
    public function getName()
175
    {
176
        return $this->name;
177
    }
178
179
    /**
180
     * Set description
181
     *
182
     * @param string $description
183
     *
184
     * @return Entry
185
     */
186
    public function setDescription($description)
187
    {
188
        $this->description = $description;
189
190
        return $this;
191
    }
192
193
    /**
194
     * Get description
195
     *
196
     * @return string
197
     */
198
    public function getDescription()
199
    {
200
        return $this->description;
201
    }
202
203
    /**
204
     * Set position
205
     *
206
     * @param integer $position
207
     *
208
     * @return Entry
209
     */
210
    public function setPosition($position)
211
    {
212
        $this->position = $position;
213
214
        return $this;
215
    }
216
217
    /**
218
     * Get position
219
     *
220
     * @return integer
221
     */
222
    public function getPosition()
223
    {
224
        return $this->position;
225
    }
226
227
    /**
228
     * Set retiredAt
229
     *
230
     * @param \DateTime $retiredAt
231
     *
232
     * @return Entry
233
     */
234
    public function setRetiredAt($retiredAt)
235
    {
236
        $this->retiredAt = $retiredAt;
237
238
        return $this;
239
    }
240
241
    /**
242
     * Get retiredAt
243
     *
244
     * @return \DateTime
245
     */
246
    public function getRetiredAt()
247
    {
248
        return $this->retiredAt;
249
    }
250
251
    /**
252
     * Set folder
253
     *
254
     * @param Folder $folder
255
     *
256
     * @return Entry
257
     */
258
    public function setFolder(Folder $folder)
259
    {
260
        $this->folder = $folder;
261
262
        return $this;
263
    }
264
265
    /**
266
     * Get folder
267
     *
268
     * @return Folder
269
     */
270
    public function getFolder()
271
    {
272
        return $this->folder;
273
    }
274
275
    /**
276
     * Set link
277
     *
278
     * @param Entry $link
279
     *
280
     * @return Entry
281
     */
282
    public function setLink(Entry $link = null)
283
    {
284
        $this->link = $link;
285
286
        return $this;
287
    }
288
289
    /**
290
     * Get link
291
     *
292
     * @return Entry
293
     */
294
    public function getLink()
295
    {
296
        return $this->link;
297
    }
298
299
    /**
300
     * Add version
301
     *
302
     * @param Version $version
303
     *
304
     * @return Entry
305
     */
306
    public function addVersion(Version $version)
307
    {
308
        $this->versions[] = $version;
309
310
        return $this;
311
    }
312
313
    /**
314
     * Remove version
315
     *
316
     * @param Version $version
317
     */
318
    public function removeVersion(Version $version)
319
    {
320
        $this->versions->removeElement($version);
321
    }
322
323
    /**
324
     * Get versions
325
     *
326
     * @return Collection
327
     */
328
    public function getVersions()
329
    {
330
        return $this->versions;
331
    }
332
333
    /**
334
     * Add history
335
     *
336
     * @param History $history
337
     *
338
     * @return Entry
339
     */
340
    public function addHistory(History $history)
341
    {
342
        $this->history[] = $history;
343
344
        return $this;
345
    }
346
347
    /**
348
     * Remove history
349
     *
350
     * @param History $history
351
     */
352
    public function removeHistory(History $history)
353
    {
354
        $this->history->removeElement($history);
355
    }
356
357
    /**
358
     * Get history
359
     *
360
     * @return Collection
361
     */
362
    public function getHistory()
363
    {
364
        return $this->history;
365
    }
366
367
    /**
368
     * Set element
369
     *
370
     * @param Element $element
371
     *
372
     * @return Entry
373
     */
374
    public function setElement(Element $element = null)
375
    {
376
        $this->element = $element;
377
378
        return $this;
379
    }
380
381
    /**
382
     * Get element
383
     *
384
     * @return Element
385
     */
386
    public function getElement()
387
    {
388
        return $this->element;
389
    }
390
391
    /**
392
     * Set archivedPeriod
393
     *
394
     * @param HistoricPeriod $archivedPeriod
395
     *
396
     * @return Entry
397
     */
398
    public function setArchivedPeriod(HistoricPeriod $archivedPeriod = null)
399
    {
400
        $this->archivedPeriod = $archivedPeriod;
401
402
        return $this;
403
    }
404
405
    /**
406
     * Get archivedPeriod
407
     *
408
     * @return HistoricPeriod
409
     */
410
    public function getArchivedPeriod()
411
    {
412
        return $this->archivedPeriod;
413
    }
414
415
    /**
416
     * @return Version
417
     */
418
    public function getCurrentVersion()
419
    {
420
        return $this->currentVersion;
421
    }
422
423
    /**
424
     * @param Version $currentVersion
425
     * @return Entry
426
     */
427
    public function setCurrentVersion($currentVersion = null)
428
    {
429
        $this->currentVersion = $currentVersion;
430
        return $this;
431
    }
432
433
    /**
434
     * Get public
435
     *
436
     * @return bool
437
     */
438
    public function isPublic()
439
    {
440
        return $this->public;
441
    }
442
443
    /**
444
     * Set public
445
     *
446
     * @param bool $public
447
     *
448
     * @return Entry
449
     */
450
    public function setPublic($public)
451
    {
452
        $this->public = $public;
453
        return $this;
454
    }
455
456
    /**
457
     * Get publicToken
458
     *
459
     * @return string
460
     */
461
    public function getPublicToken()
462
    {
463
        return $this->publicToken;
464
    }
465
466
    /**
467
     * Set publicToken
468
     *
469
     * @param string $publicToken
470
     *
471
     * @return Entry
472
     */
473
    public function setPublicToken($publicToken)
474
    {
475
        $this->publicToken = $publicToken;
476
        return $this;
477
    }
478
}
479