1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the thealternativezurich/feedback project. |
5
|
|
|
* |
6
|
|
|
* (c) Florian Moser <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace App\Entity; |
13
|
|
|
|
14
|
|
|
use App\Entity\Base\BaseEntity; |
15
|
|
|
use App\Entity\Traits\IdTrait; |
16
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
17
|
|
|
use Doctrine\ORM\Mapping as ORM; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* a semester contains of events. |
21
|
|
|
* |
22
|
|
|
* @ORM\Entity() |
23
|
|
|
* @ORM\HasLifecycleCallbacks |
24
|
|
|
*/ |
25
|
|
|
class Semester extends BaseEntity |
26
|
|
|
{ |
27
|
|
|
use IdTrait; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @var string |
31
|
|
|
* |
32
|
|
|
* @ORM\Column(type="text") |
33
|
|
|
*/ |
34
|
|
|
private $name; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @var \DateTime |
38
|
|
|
* |
39
|
|
|
* @ORM\Column(type="datetime") |
40
|
|
|
*/ |
41
|
|
|
private $creationDate; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @var Event[]|ArrayCollection |
45
|
|
|
* |
46
|
|
|
* @ORM\OneToMany(targetEntity="Event", mappedBy="semester") |
47
|
|
|
* @ORM\OrderBy({"date" = "DESC", "feedbackStartTime" = "DESC", "feedbackEndTime" = "DESC"}) |
48
|
|
|
*/ |
49
|
|
|
private $events; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Semester constructor. |
53
|
|
|
*/ |
54
|
|
|
public function __construct() |
55
|
|
|
{ |
56
|
|
|
$this->events = new ArrayCollection(); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
public function getName(): string |
60
|
|
|
{ |
61
|
|
|
return $this->name; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
public function setName(string $name): void |
65
|
|
|
{ |
66
|
|
|
$this->name = $name; |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @return Event[]|ArrayCollection |
71
|
|
|
*/ |
72
|
|
|
public function getEvents() |
73
|
|
|
{ |
74
|
|
|
return $this->events; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
public function getCreationDate(): \DateTime |
78
|
|
|
{ |
79
|
|
|
return $this->creationDate; |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
public function setCreationDate(\DateTime $creationDate): void |
83
|
|
|
{ |
84
|
|
|
$this->creationDate = $creationDate; |
85
|
|
|
} |
86
|
|
|
} |
87
|
|
|
|