|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types = 1); |
|
4
|
|
|
/** |
|
5
|
|
|
* Question / Frage. |
|
6
|
|
|
*/ |
|
7
|
|
|
|
|
8
|
|
|
namespace HDNET\Faq\Domain\Model; |
|
9
|
|
|
|
|
10
|
|
|
use HDNET\Autoloader\Annotation\DatabaseField; |
|
11
|
|
|
use HDNET\Autoloader\Annotation\DatabaseTable; |
|
12
|
|
|
use TYPO3\CMS\Extbase\Persistence\ObjectStorage; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* Question / Frage. |
|
16
|
|
|
* |
|
17
|
|
|
* @DatabaseTable |
|
18
|
|
|
*/ |
|
19
|
|
|
class Question extends AbstractModel |
|
20
|
|
|
{ |
|
21
|
|
|
/** |
|
22
|
|
|
* Title. |
|
23
|
|
|
* |
|
24
|
|
|
* @var string |
|
25
|
|
|
* @DatabaseField(type="string") |
|
26
|
|
|
*/ |
|
27
|
|
|
protected $title = ''; |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* Answer. |
|
31
|
|
|
* |
|
32
|
|
|
* @var string |
|
33
|
|
|
* @DatabaseField(type="string") |
|
34
|
|
|
*/ |
|
35
|
|
|
protected $answer = ''; |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* Tags. |
|
39
|
|
|
* |
|
40
|
|
|
* @var string |
|
41
|
|
|
* @DatabaseField(type="string") |
|
42
|
|
|
*/ |
|
43
|
|
|
protected $tags = ''; |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* Top Counter. |
|
47
|
|
|
* |
|
48
|
|
|
* @var int |
|
49
|
|
|
* @DatabaseField(type="int") |
|
50
|
|
|
*/ |
|
51
|
|
|
protected $topCounter = 0; |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* Flop Counter. |
|
55
|
|
|
* |
|
56
|
|
|
* @var int |
|
57
|
|
|
* @DatabaseField(type="int") |
|
58
|
|
|
*/ |
|
59
|
|
|
protected $flopCounter = 0; |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* @var int |
|
63
|
|
|
*/ |
|
64
|
|
|
protected $_languageUid = 0; |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* Categories. |
|
68
|
|
|
* |
|
69
|
|
|
* @var ObjectStorage<QuestionCategory> |
|
70
|
|
|
* @DatabaseField(type="int", sql="int(11) DEFAULT '0' NOT NULL") |
|
71
|
|
|
*/ |
|
72
|
|
|
protected $categories; |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* @var \DateTime |
|
76
|
|
|
*/ |
|
77
|
|
|
protected $crdate; |
|
78
|
|
|
|
|
79
|
|
|
/** |
|
80
|
|
|
* Question constructor. |
|
81
|
|
|
*/ |
|
82
|
|
|
public function __construct() |
|
83
|
|
|
{ |
|
84
|
|
|
$this->categories = new ObjectStorage(); |
|
85
|
|
|
$this->crdate = new \DateTime(); |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* Set the title. |
|
90
|
|
|
*/ |
|
91
|
|
|
public function setTitle(string $title): void |
|
92
|
|
|
{ |
|
93
|
|
|
$this->title = $title; |
|
94
|
|
|
} |
|
95
|
|
|
|
|
96
|
|
|
/** |
|
97
|
|
|
* Get the title. |
|
98
|
|
|
*/ |
|
99
|
|
|
public function getTitle(): string |
|
100
|
|
|
{ |
|
101
|
|
|
return $this->title; |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
/** |
|
105
|
|
|
* Set answer. |
|
106
|
|
|
*/ |
|
107
|
|
|
public function setAnswer(string $answer): void |
|
108
|
|
|
{ |
|
109
|
|
|
$this->answer = $answer; |
|
110
|
|
|
} |
|
111
|
|
|
|
|
112
|
|
|
/** |
|
113
|
|
|
* Get answer. |
|
114
|
|
|
*/ |
|
115
|
|
|
public function getAnswer(): string |
|
116
|
|
|
{ |
|
117
|
|
|
return $this->answer; |
|
118
|
|
|
} |
|
119
|
|
|
|
|
120
|
|
|
/** |
|
121
|
|
|
* Set tags. |
|
122
|
|
|
*/ |
|
123
|
|
|
public function setTags(string $tags): void |
|
124
|
|
|
{ |
|
125
|
|
|
$this->tags = $tags; |
|
126
|
|
|
} |
|
127
|
|
|
|
|
128
|
|
|
/** |
|
129
|
|
|
* Get tags. |
|
130
|
|
|
*/ |
|
131
|
|
|
public function getTags(): string |
|
132
|
|
|
{ |
|
133
|
|
|
return $this->tags; |
|
134
|
|
|
} |
|
135
|
|
|
|
|
136
|
|
|
/** |
|
137
|
|
|
* Set the top counter. |
|
138
|
|
|
*/ |
|
139
|
|
|
public function setTopCounter(int $topCounter): void |
|
140
|
|
|
{ |
|
141
|
|
|
$this->topCounter = $topCounter; |
|
142
|
|
|
} |
|
143
|
|
|
|
|
144
|
|
|
/** |
|
145
|
|
|
* Get the top counter. |
|
146
|
|
|
*/ |
|
147
|
|
|
public function getTopCounter(): int |
|
148
|
|
|
{ |
|
149
|
|
|
return (int)$this->topCounter; |
|
150
|
|
|
} |
|
151
|
|
|
|
|
152
|
|
|
/** |
|
153
|
|
|
* Set the categories. |
|
154
|
|
|
* |
|
155
|
|
|
* @param ObjectStorage $categories |
|
156
|
|
|
*/ |
|
157
|
|
|
public function setCategories($categories): void |
|
158
|
|
|
{ |
|
159
|
|
|
$this->categories = $categories; |
|
160
|
|
|
} |
|
161
|
|
|
|
|
162
|
|
|
/** |
|
163
|
|
|
* Get the categories. |
|
164
|
|
|
*/ |
|
165
|
|
|
public function getCategories(): ObjectStorage |
|
166
|
|
|
{ |
|
167
|
|
|
return $this->categories; |
|
168
|
|
|
} |
|
169
|
|
|
|
|
170
|
|
|
/** |
|
171
|
|
|
* Set the Flop Counter. |
|
172
|
|
|
*/ |
|
173
|
|
|
public function setFlopCounter(int $flopCounter): void |
|
174
|
|
|
{ |
|
175
|
|
|
$this->flopCounter = $flopCounter; |
|
176
|
|
|
} |
|
177
|
|
|
|
|
178
|
|
|
/** |
|
179
|
|
|
* Get the flop counter. |
|
180
|
|
|
*/ |
|
181
|
|
|
public function getFlopCounter(): int |
|
182
|
|
|
{ |
|
183
|
|
|
return (int)$this->flopCounter; |
|
184
|
|
|
} |
|
185
|
|
|
|
|
186
|
|
|
/** |
|
187
|
|
|
* Public getter for the languageUid. |
|
188
|
|
|
*/ |
|
189
|
|
|
public function getLanguageId(): int |
|
190
|
|
|
{ |
|
191
|
|
|
return $this->_languageUid; |
|
192
|
|
|
} |
|
193
|
|
|
|
|
194
|
|
|
public function getCrdate(): \DateTime |
|
195
|
|
|
{ |
|
196
|
|
|
return $this->crdate; |
|
197
|
|
|
} |
|
198
|
|
|
} |
|
199
|
|
|
|