|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Stu\Orm\Entity; |
|
6
|
|
|
|
|
7
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
|
8
|
|
|
use Doctrine\Common\Collections\Collection; |
|
9
|
|
|
use Doctrine\ORM\Mapping\Column; |
|
10
|
|
|
use Doctrine\ORM\Mapping\Entity; |
|
11
|
|
|
use Doctrine\ORM\Mapping\GeneratedValue; |
|
12
|
|
|
use Doctrine\ORM\Mapping\Id; |
|
13
|
|
|
use Doctrine\ORM\Mapping\Index; |
|
14
|
|
|
use Doctrine\ORM\Mapping\Table; |
|
15
|
|
|
use Doctrine\ORM\Mapping\UniqueConstraint; |
|
16
|
|
|
use Stu\Orm\Repository\RpgPlotArchivRepository; |
|
17
|
|
|
|
|
18
|
|
|
#[Table(name: 'stu_plots_archiv')] |
|
19
|
|
|
#[Index(name: 'rpg_plot_archiv_end_date_idx', columns: ['end_date'])] |
|
20
|
|
|
#[UniqueConstraint(name: 'unique_plot_id', columns: ['id'])] |
|
21
|
|
|
#[UniqueConstraint(name: 'unique_former_id', columns: ['former_id'])] |
|
22
|
|
|
#[Entity(repositoryClass: RpgPlotArchivRepository::class)] |
|
23
|
|
|
class RpgPlotArchiv |
|
24
|
|
|
{ |
|
25
|
|
|
#[Id] |
|
26
|
|
|
#[Column(type: 'integer')] |
|
27
|
|
|
#[GeneratedValue(strategy: 'IDENTITY')] |
|
28
|
|
|
private int $id; |
|
29
|
|
|
|
|
30
|
|
|
#[Column(type: 'string')] |
|
31
|
|
|
private string $version = ''; |
|
32
|
|
|
|
|
33
|
|
|
#[Column(type: 'integer')] |
|
34
|
|
|
private int $former_id = 0; |
|
35
|
|
|
|
|
36
|
|
|
#[Column(type: 'integer')] |
|
37
|
|
|
private int $user_id = 0; |
|
38
|
|
|
|
|
39
|
|
|
#[Column(type: 'string')] |
|
40
|
|
|
private string $title = ''; |
|
41
|
|
|
|
|
42
|
|
|
#[Column(type: 'text')] |
|
43
|
|
|
private string $description = ''; |
|
44
|
|
|
|
|
45
|
|
|
#[Column(type: 'integer')] |
|
46
|
|
|
private int $start_date = 0; |
|
47
|
|
|
|
|
48
|
|
|
#[Column(type: 'integer', nullable: true)] |
|
49
|
|
|
private ?int $end_date = null; |
|
50
|
|
|
|
|
51
|
|
|
public function getId(): int |
|
52
|
|
|
{ |
|
53
|
|
|
return $this->id; |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
public function getVersion(): ?string |
|
57
|
|
|
{ |
|
58
|
|
|
return $this->version; |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
public function getFormerId(): int |
|
62
|
|
|
{ |
|
63
|
|
|
return $this->former_id; |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
public function getUserId(): int |
|
67
|
|
|
{ |
|
68
|
|
|
return $this->user_id; |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
public function getTitle(): string |
|
72
|
|
|
{ |
|
73
|
|
|
return $this->title; |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
public function setTitle(string $title): RpgPlotArchiv |
|
77
|
|
|
{ |
|
78
|
|
|
$this->title = $title; |
|
79
|
|
|
return $this; |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
public function getDescription(): string |
|
83
|
|
|
{ |
|
84
|
|
|
return $this->description; |
|
85
|
|
|
} |
|
86
|
|
|
|
|
87
|
|
|
public function setDescription(string $description): RpgPlotArchiv |
|
88
|
|
|
{ |
|
89
|
|
|
$this->description = $description; |
|
90
|
|
|
return $this; |
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
|
|
public function getStartDate(): int |
|
94
|
|
|
{ |
|
95
|
|
|
return $this->start_date; |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
|
|
public function setStartDate(int $startDate): RpgPlotArchiv |
|
99
|
|
|
{ |
|
100
|
|
|
$this->start_date = $startDate; |
|
101
|
|
|
return $this; |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
public function getEndDate(): ?int |
|
105
|
|
|
{ |
|
106
|
|
|
return $this->end_date; |
|
107
|
|
|
} |
|
108
|
|
|
|
|
109
|
|
|
public function setEndDate(?int $endDate): RpgPlotArchiv |
|
110
|
|
|
{ |
|
111
|
|
|
$this->end_date = $endDate; |
|
112
|
|
|
return $this; |
|
113
|
|
|
} |
|
114
|
|
|
|
|
115
|
|
|
public function isActive(): bool |
|
116
|
|
|
{ |
|
117
|
|
|
return $this->getEndDate() === null || $this->getEndDate() === 0; |
|
118
|
|
|
} |
|
119
|
|
|
|
|
120
|
|
|
public function __toString(): string |
|
121
|
|
|
{ |
|
122
|
|
|
return sprintf('title: %s', $this->getTitle()); |
|
123
|
|
|
} |
|
124
|
|
|
} |
|
125
|
|
|
|