1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Entity; |
4
|
|
|
|
5
|
|
|
use App\Model\AttachmentInterface; |
6
|
|
|
use App\Model\LessonInterface; |
7
|
|
|
use App\Model\PersistableAwareTrait; |
8
|
|
|
use App\Model\SortableAwareTrait; |
9
|
|
|
use App\Model\TimestampableAwareTrait; |
10
|
|
|
use DateTime; |
11
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
12
|
|
|
use Doctrine\Common\Collections\Collection; |
13
|
|
|
use Symfony\Component\HttpFoundation\File\File; |
14
|
|
|
|
15
|
|
|
class Lesson implements LessonInterface |
16
|
|
|
{ |
17
|
|
|
use TimestampableAwareTrait, SortableAwareTrait, PersistableAwareTrait; |
18
|
|
|
|
19
|
|
|
private $title; |
20
|
|
|
|
21
|
|
|
private $description; |
22
|
|
|
|
23
|
|
|
private $embedCode; |
24
|
|
|
|
25
|
|
|
private $module; |
26
|
|
|
|
27
|
|
|
private $coverImageName; |
28
|
|
|
|
29
|
|
|
private $durationInMinutes = 0; |
30
|
|
|
|
31
|
|
|
private $attachments; |
32
|
|
|
|
33
|
|
|
private $coverImageFile; |
34
|
|
|
|
35
|
|
|
public function __construct() |
36
|
|
|
{ |
37
|
|
|
$this->attachments = new ArrayCollection(); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
public function getTitle(): ?string |
41
|
|
|
{ |
42
|
|
|
return $this->title; |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
public function setTitle(string $title): void |
46
|
|
|
{ |
47
|
|
|
$this->title = $title; |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
public function getDescription(): ?string |
51
|
|
|
{ |
52
|
|
|
return $this->description; |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
public function setDescription(string $description): void |
56
|
|
|
{ |
57
|
|
|
$this->description = $description; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
public function getEmbedCode(): ?string |
61
|
|
|
{ |
62
|
|
|
return $this->embedCode; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
public function setEmbedCode(string $embedCode): void |
66
|
|
|
{ |
67
|
|
|
$this->embedCode = $embedCode; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
public function getModule(): ?Module |
71
|
|
|
{ |
72
|
|
|
return $this->module; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
public function setModule(?Module $module): void |
76
|
|
|
{ |
77
|
|
|
$this->module = $module; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
public function getCoverImageName(): ?string |
81
|
|
|
{ |
82
|
|
|
return $this->coverImageName; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
public function setCoverImageName(?string $coverImageName): void |
86
|
|
|
{ |
87
|
|
|
$this->coverImageName = $coverImageName; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
public function setCoverImageFile(?File $coverImageFile = null): void |
91
|
|
|
{ |
92
|
|
|
$this->coverImageFile = $coverImageFile; |
93
|
|
|
$this->updated = new DateTime(); |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
public function getCoverImageFile(): ?File |
97
|
|
|
{ |
98
|
|
|
return $this->coverImageFile; |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
public function getDurationInMinutes(): int |
102
|
|
|
{ |
103
|
|
|
return $this->durationInMinutes; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
public function setDurationInMinutes(int $durationInMinutes): void |
107
|
|
|
{ |
108
|
|
|
$this->durationInMinutes = $durationInMinutes; |
109
|
|
|
} |
110
|
|
|
|
111
|
|
|
public function getAttachments(): Collection |
112
|
|
|
{ |
113
|
|
|
return $this->attachments; |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
public function addAttachment(AttachmentInterface $attachment): void |
117
|
|
|
{ |
118
|
|
|
if (!$this->attachments->contains($attachment)) { |
119
|
|
|
$this->attachments->add($attachment); |
120
|
|
|
} |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
public function removeAttachment(AttachmentInterface $attachment): void |
124
|
|
|
{ |
125
|
|
|
if ($this->attachments->contains($attachment)) { |
126
|
|
|
$this->attachments->removeElement($attachment); |
127
|
|
|
} |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
public function __toString() |
131
|
|
|
{ |
132
|
|
|
return (string) $this->getTitle(); |
133
|
|
|
} |
134
|
|
|
} |
135
|
|
|
|