1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Entity; |
4
|
|
|
|
5
|
|
|
use App\Model\CourseInterface; |
6
|
|
|
use App\Model\TimeLimitedAwareTrait; |
7
|
|
|
use App\Model\TimestampableAwareTrait; |
8
|
|
|
use App\Model\VisibilityAwareTrait; |
9
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
10
|
|
|
use Doctrine\Common\Collections\Collection; |
11
|
|
|
use Symfony\Component\HttpFoundation\File\File; |
12
|
|
|
|
13
|
|
|
class Course implements CourseInterface |
14
|
|
|
{ |
15
|
|
|
use TimestampableAwareTrait, VisibilityAwareTrait, TimeLimitedAwareTrait; |
16
|
|
|
|
17
|
|
|
private $id; |
18
|
|
|
|
19
|
|
|
private $title; |
20
|
|
|
|
21
|
|
|
private $description; |
22
|
|
|
|
23
|
|
|
private $coverImageName; |
24
|
|
|
|
25
|
|
|
private $coverImageFile; |
26
|
|
|
|
27
|
|
|
private $authors; |
28
|
|
|
|
29
|
|
|
public function __construct() |
30
|
|
|
{ |
31
|
|
|
$this->setVisible(true); |
32
|
|
|
$this->setAuthors(new ArrayCollection()); |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
public function getId(): ?int |
36
|
|
|
{ |
37
|
|
|
return $this->id; |
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 getCoverImageName(): ?string |
61
|
|
|
{ |
62
|
|
|
return $this->coverImageName; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
public function setCoverImageName(?string $coverImageName): void |
66
|
|
|
{ |
67
|
|
|
$this->coverImageName = $coverImageName; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
public function setCoverImageFile(?File $coverImageFile = null): void |
71
|
|
|
{ |
72
|
|
|
$this->coverImageFile = $coverImageFile; |
73
|
|
|
$this->updated = new \DateTime(); |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
public function getCoverImageFile(): ?File |
77
|
|
|
{ |
78
|
|
|
return $this->coverImageFile; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
public function getAuthors(): Collection |
82
|
|
|
{ |
83
|
|
|
return $this->authors; |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
public function setAuthors(Collection $authors): void |
87
|
|
|
{ |
88
|
|
|
$this->authors = $authors; |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
public function __toString() |
92
|
|
|
{ |
93
|
|
|
return (string) ($this->title ?? 'New course'); |
94
|
|
|
} |
95
|
|
|
} |
96
|
|
|
|