Newer
Older
<?php
namespace SGalinski\SgNews\Domain\Model;
/***************************************************************
* Copyright notice
*
* (c) sgalinski Internet Services (https://www.sgalinski.de)
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use TYPO3\CMS\Extbase\Domain\Model\FrontendUser;
use TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy;
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
/**
* News
*/
class News extends CategoryAndNews {
/**
* @var string
*/
protected $description = '';
/**
* @var string
*/
protected $author = '';
/**
* @var boolean
*/
protected $highlighted = FALSE;
Fabian Galinski
committed
/**
* @var boolean
*/
protected $neverHighlighted = FALSE;
/**
* @var \DateTime
*/
protected $lastUpdated;
/**
* @var \DateTime
*/
protected $dateEnd;
/**
* @var \DateTime
*/
protected $creationDate;
/**
* @lazy
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\SGalinski\SgNews\Domain\Model\News>
*/
protected $relatedNews;
/**
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\SGalinski\SgNews\Domain\Model\Tag>
*/
protected $tags;
/**
* @lazy
* @var \TYPO3\CMS\Extbase\Domain\Model\FrontendUser
*/
protected $authorFrontendUser;
/**
* @var int
*/
protected $likes;
/**
* @var string
*/
protected $location;
/**
* Constructor
*/
public function __construct() {
parent::__construct();
$this->relatedNews = new ObjectStorage();
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
}
/**
* @param string $author
* @return void
*/
public function setAuthor($author) {
$this->author = $author;
}
/**
* @return string
*/
public function getAuthor() {
return $this->author;
}
/**
* @param string $description
* @return void
*/
public function setDescription($description) {
$this->description = $description;
}
/**
* @return string
*/
public function getDescription() {
return $this->description;
}
/**
* @param \DateTime $lastUpdated
* @return void
*/
public function setLastUpdated(\DateTime $lastUpdated) {
$this->lastUpdated = $lastUpdated;
}
/**
* @return \DateTime
*/
public function getLastUpdated() {
return $this->lastUpdated;
}
/**
* @return \DateTime
*/
public function getDateEnd() {
return $this->dateEnd;
}
/**
* @param \DateTime $dateEnd
*/
public function setDateEnd(\DateTime $dateEnd) {
$this->dateEnd = $dateEnd;
}
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
/**
* @param \DateTime $creationDate
* @return void
*/
public function setCreationDate(\DateTime $creationDate) {
$this->creationDate = $creationDate;
}
/**
* @return \DateTime
*/
public function getCreationDate() {
return $this->creationDate;
}
/**
* @param ObjectStorage $relatedNews
* @return void
*/
public function setRelatedNews(ObjectStorage $relatedNews) {
$this->relatedNews = $relatedNews;
}
/**
* @return ObjectStorage
*/
public function getRelatedNews() {
if ($this->relatedNews instanceof LazyLoadingProxy) {
$this->relatedNews->_loadRealInstance();
}
return $this->relatedNews;
}
/**
* @param News $relatedNews
* @return void
*/
public function addRelatedNews(News $relatedNews) {
if ($this->relatedNews instanceof LazyLoadingProxy) {
$this->relatedNews->_loadRealInstance();
}
$this->relatedNews->attach($relatedNews);
}
/**
* @param News $relatedNews
* @return void
*/
public function removeRelatedNews(News $relatedNews) {
if ($this->relatedNews instanceof LazyLoadingProxy) {
$this->relatedNews->_loadRealInstance();
}
$this->relatedNews->detach($relatedNews);
}
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
/**
* @param ObjectStorage $tags
* @return void
*/
public function setTags(ObjectStorage $tags) {
$this->tags = $tags;
}
/**
* @return ObjectStorage
*/
public function getTags() {
return $this->tags;
}
/**
* @param Tag $tag
* @return void
*/
public function addTag(Tag $tag) {
$this->tags->attach($tag);
}
/**
* @param Tag $tag
* @return void
*/
public function removeTags(Tag $tag) {
$this->tags->detach($tag);
}
/**
* @param boolean $highlighted
*/
public function setHighlighted($highlighted) {
$this->highlighted = (bool) $highlighted;
}
/**
* @return boolean
*/
public function getHighlighted() {
return $this->highlighted;
}
Fabian Galinski
committed
/**
* @return bool
*/
public function getNeverHighlighted() {
return $this->neverHighlighted;
}
/**
* @param bool $neverHighlighted
* @return void
*/
public function setNeverHighlighted($neverHighlighted) {
$this->neverHighlighted = (bool) $neverHighlighted;
Fabian Galinski
committed
}
/**
* @param FrontendUser $authorFrontendUser
* @return void
*/
public function setAuthorFrontendUser(FrontendUser $authorFrontendUser) {
$this->authorFrontendUser = $authorFrontendUser;
}
/**
* @return FrontendUser
*/
public function getAuthorFrontendUser() {
if ($this->authorFrontendUser instanceof LazyLoadingProxy) {
$this->authorFrontendUser->_loadRealInstance();
}
return $this->authorFrontendUser;
}
/**
* @return int
*/
public function getLikes() {
return $this->likes;
}
/**
* @param int $likes
*/
public function setLikes($likes) {
$this->likes = $likes;
}
/**
* @return string
*/
public function getLocation() {
return $this->location;
}
/**
* @param string $location
*/
public function setLocation($location) {
$this->location = $location;
}