‪TYPO3CMS  9.5
Post.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
18 
23 {
27  protected ‪$blog;
28 
33  protected ‪$title = '';
34 
38  protected ‪$date;
39 
43  protected ‪$author;
44 
48  protected ‪$secondAuthor;
49 
53  protected ‪$reviewer;
54 
59  protected ‪$content = '';
60 
64  protected ‪$tags;
65 
69  protected ‪$categories;
70 
76  protected ‪$comments;
77 
82  protected ‪$relatedPosts;
83 
88  protected ‪$additionalName;
89 
94  protected ‪$additionalInfo;
95 
101  protected ‪$additionalComments;
102 
106  public function ‪__construct()
107  {
108  $this->tags = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
109  $this->categories = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
110  $this->comments = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
111  $this->relatedPosts = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
112  $this->date = new \DateTime();
113  $this->additionalComments = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
114  }
115 
121  public function ‪setBlog(\‪ExtbaseTeam\BlogExample\Domain\Model\‪Blog ‪$blog)
122  {
123  $this->blog = ‪$blog;
124  }
125 
131  public function ‪getBlog()
132  {
133  return ‪$this->blog;
134  }
135 
141  public function ‪setTitle(‪$title)
142  {
143  $this->title = ‪$title;
144  }
145 
151  public function ‪getTitle()
152  {
153  return ‪$this->title;
154  }
155 
161  public function ‪setDate(\DateTime ‪$date)
162  {
163  $this->date = ‪$date;
164  }
165 
172  public function ‪getDate()
173  {
174  return ‪$this->date;
175  }
176 
182  public function ‪setTags(\‪TYPO3\CMS\‪Extbase\Persistence\ObjectStorage ‪$tags)
183  {
184  $this->tags = ‪$tags;
185  }
186 
192  public function ‪addTag(Tag $tag)
193  {
194  $this->tags->attach($tag);
195  }
196 
202  public function ‪removeTag(‪Tag $tag)
203  {
204  $this->tags->detach($tag);
205  }
206 
210  public function ‪removeAllTags()
211  {
212  $this->tags = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
213  }
214 
221  public function ‪getTags()
222  {
223  return clone ‪$this->tags;
224  }
225 
231  public function ‪addCategory(\‪TYPO3\CMS\‪Extbase\Domain\Model\Category $category)
232  {
233  $this->categories->attach($category);
234  }
235 
241  public function ‪setCategories(‪$categories)
242  {
243  $this->categories = ‪$categories;
244  }
245 
251  public function ‪getCategories()
252  {
253  return ‪$this->categories;
254  }
255 
261  public function ‪removeCategory(\‪TYPO3\CMS\‪Extbase\Domain\Model\Category $category)
262  {
263  $this->categories->detach($category);
264  }
265 
271  public function ‪setAuthor(\‪ExtbaseTeam\BlogExample\Domain\Model\Person ‪$author)
272  {
273  $this->author = ‪$author;
274  }
275 
281  public function ‪getAuthor()
282  {
284  }
285 
289  public function ‪getSecondAuthor(): ?\‪ExtbaseTeam\BlogExample\Domain\Model\‪Person
290  {
292  }
293 
297  public function ‪setSecondAuthor(\‪ExtbaseTeam\BlogExample\Domain\Model\‪Person ‪$secondAuthor): void
298  {
299  $this->secondAuthor = ‪$secondAuthor;
300  }
301 
305  public function ‪getReviewer()
306  {
307  return ‪$this->reviewer;
308  }
309 
313  public function ‪setReviewer(\‪ExtbaseTeam\BlogExample\Domain\Model\‪Person ‪$reviewer)
314  {
315  $this->reviewer = ‪$reviewer;
316  }
317 
323  public function ‪setContent(‪$content)
324  {
325  $this->content = ‪$content;
326  }
327 
333  public function ‪getContent()
334  {
335  return ‪$this->content;
336  }
337 
343  public function ‪setComments(\‪TYPO3\CMS\‪Extbase\Persistence\ObjectStorage ‪$comments)
344  {
345  $this->comments = ‪$comments;
346  }
347 
353  public function ‪addComment(Comment $comment)
354  {
355  $this->comments->attach($comment);
356  }
357 
363  public function ‪removeComment(‪Comment $commentToDelete)
364  {
365  $this->comments->detach($commentToDelete);
366  }
367 
371  public function ‪removeAllComments()
372  {
374  $this->comments->removeAll(‪$comments);
375  }
376 
382  public function ‪getComments()
383  {
384  return ‪$this->comments;
385  }
386 
392  public function ‪setRelatedPosts(\‪TYPO3\CMS\‪Extbase\Persistence\ObjectStorage ‪$relatedPosts)
393  {
394  $this->relatedPosts = ‪$relatedPosts;
395  }
396 
402  public function ‪addRelatedPost(‪Post $post)
403  {
404  $this->relatedPosts->attach($post);
405  }
406 
410  public function ‪removeAllRelatedPosts()
411  {
413  $this->relatedPosts->removeAll(‪$relatedPosts);
414  }
415 
421  public function ‪getRelatedPosts()
422  {
424  }
425 
429  public function ‪getAdditionalName(): ?‪Info
430  {
432  }
433 
437  public function ‪setAdditionalName(‪Info ‪$additionalName): void
438  {
439  $this->additionalName = ‪$additionalName;
440  }
441 
445  public function ‪getAdditionalInfo(): ?‪Info
446  {
448  }
449 
453  public function ‪setAdditionalInfo(‪Info ‪$additionalInfo): void
454  {
455  $this->additionalInfo = ‪$additionalInfo;
456  }
457 
461  public function ‪getAdditionalComments(): \‪TYPO3\CMS\‪Extbase\Persistence\ObjectStorage
462  {
464  }
465 
469  public function ‪setAdditionalComments(\‪TYPO3\CMS\‪Extbase\Persistence\ObjectStorage ‪$additionalComments): void
470  {
471  $this->additionalComments = ‪$additionalComments;
472  }
473 
477  public function ‪addAdditionalComment(‪Comment $comment)
478  {
479  $this->additionalComments->attach($comment);
480  }
481 
485  public function ‪removeAllAdditionalComments()
486  {
488  $this->additionalComments->removeAll(‪$comments);
489  }
490 
494  public function ‪removeAdditionalComment(‪Comment $comment)
495  {
496  $this->additionalComments->detach($comment);
497  }
498 
504  public function ‪__toString()
505  {
506  return $this->title . chr(10) .
507  ' written on ' . $this->date->format('Y-m-d') . chr(10) .
508  ' by ' . $this->author->getFullName() . chr(10) .
509  wordwrap($this->content, 70, chr(10)) . chr(10) .
510  implode(', ', $this->tags->toArray());
511  }
512 }
‪ExtbaseTeam\BlogExample\Domain\Model\Post\getComments
‪TYPO3 CMS Extbase Persistence ObjectStorage getComments()
Definition: Post.php:368
‪ExtbaseTeam\BlogExample\Domain\Model\Post\setAdditionalName
‪setAdditionalName(Info $additionalName)
Definition: Post.php:423
‪ExtbaseTeam\BlogExample\Domain\Model\Post\setTags
‪setTags(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $tags)
Definition: Post.php:168
‪ExtbaseTeam\BlogExample\Domain\Model\Post\getBlog
‪ExtbaseTeam BlogExample Domain Model Blog getBlog()
Definition: Post.php:117
‪TYPO3\CMS\Extbase\Annotation
Definition: IgnoreValidation.php:4
‪ExtbaseTeam\BlogExample\Domain\Model\Post\addAdditionalComment
‪addAdditionalComment(Comment $comment)
Definition: Post.php:463
‪ExtbaseTeam\BlogExample\Domain\Model\Post\removeComment
‪removeComment(Comment $commentToDelete)
Definition: Post.php:349
‪ExtbaseTeam\BlogExample\Domain\Model\Post\addComment
‪addComment(Comment $comment)
Definition: Post.php:339
‪ExtbaseTeam\BlogExample\Domain\Model\Post\$title
‪string $title
Definition: Post.php:31
‪ExtbaseTeam\BlogExample\Domain\Model\Post\$additionalComments
‪TYPO3 CMS Extbase Persistence ObjectStorage<\ExtbaseTeam\BlogExample\Domain\Model\Comment > $additionalComments
Definition: Post.php:87
‪TYPO3
‪ExtbaseTeam\BlogExample\Domain\Model\Post\$content
‪string $content
Definition: Post.php:52
‪ExtbaseTeam\BlogExample\Domain\Model\Post\getRelatedPosts
‪TYPO3 CMS Extbase Persistence ObjectStorage getRelatedPosts()
Definition: Post.php:407
‪ExtbaseTeam\BlogExample\Domain\Model\Post\$date
‪DateTime $date
Definition: Post.php:35
‪ExtbaseTeam\BlogExample\Domain\Model\Post\setTitle
‪setTitle($title)
Definition: Post.php:127
‪ExtbaseTeam\BlogExample\Domain\Model\Post\setBlog
‪setBlog(\ExtbaseTeam\BlogExample\Domain\Model\Blog $blog)
Definition: Post.php:107
‪ExtbaseTeam\BlogExample\Domain\Model\Post\$categories
‪TYPO3 CMS Extbase Persistence ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\Category > $categories
Definition: Post.php:60
‪ExtbaseTeam\BlogExample\Domain\Model\Post\$relatedPosts
‪TYPO3 CMS Extbase Persistence ObjectStorage<\ExtbaseTeam\BlogExample\Domain\Model\Post > $relatedPosts
Definition: Post.php:71
‪ExtbaseTeam\BlogExample\Domain\Model\Post\getReviewer
‪ExtbaseTeam BlogExample Domain Model Person getReviewer()
Definition: Post.php:291
‪ExtbaseTeam\BlogExample\Domain\Model\Info
Definition: Info.php:21
‪ExtbaseTeam\BlogExample\Domain\Model\Post\setReviewer
‪setReviewer(\ExtbaseTeam\BlogExample\Domain\Model\Person $reviewer)
Definition: Post.php:299
‪ExtbaseTeam\BlogExample\Domain\Model\Post\getTitle
‪string getTitle()
Definition: Post.php:137
‪ExtbaseTeam\BlogExample\Domain\Model\Post\getContent
‪string getContent()
Definition: Post.php:319
‪ExtbaseTeam\BlogExample\Domain\Model\Post\$secondAuthor
‪ExtbaseTeam BlogExample Domain Model Person $secondAuthor
Definition: Post.php:43
‪ExtbaseTeam\BlogExample\Domain\Model\Post\$additionalInfo
‪ExtbaseTeam BlogExample Domain Model Info $additionalInfo
Definition: Post.php:81
‪ExtbaseTeam\BlogExample\Domain\Model\Post\setAdditionalInfo
‪setAdditionalInfo(Info $additionalInfo)
Definition: Post.php:439
‪TYPO3\CMS\Extbase\DomainObject\AbstractEntity
Definition: AbstractEntity.php:22
‪ExtbaseTeam\BlogExample\Domain\Model\Post\setDate
‪setDate(\DateTime $date)
Definition: Post.php:147
‪ExtbaseTeam\BlogExample\Domain\Model\Post\removeAllAdditionalComments
‪removeAllAdditionalComments()
Definition: Post.php:471
‪ExtbaseTeam\BlogExample\Domain\Model\Post\getAdditionalName
‪Info getAdditionalName()
Definition: Post.php:415
‪ExtbaseTeam\BlogExample\Domain\Model\Post\getSecondAuthor
‪ExtbaseTeam BlogExample Domain Model Person getSecondAuthor()
Definition: Post.php:275
‪ExtbaseTeam\BlogExample\Domain\Model\Post\getCategories
‪TYPO3 CMS Extbase Persistence ObjectStorage getCategories()
Definition: Post.php:237
‪ExtbaseTeam\BlogExample\Domain\Model\Post\removeAdditionalComment
‪removeAdditionalComment(Comment $comment)
Definition: Post.php:480
‪ExtbaseTeam\BlogExample\Domain\Model\Post\getTags
‪TYPO3 CMS Extbase Persistence ObjectStorage getTags()
Definition: Post.php:207
‪ExtbaseTeam\BlogExample\Domain\Model\Post\addRelatedPost
‪addRelatedPost(Post $post)
Definition: Post.php:388
‪ExtbaseTeam\BlogExample\Domain\Model\Post\setComments
‪setComments(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $comments)
Definition: Post.php:329
‪ExtbaseTeam\BlogExample\Domain\Model\Post\getAdditionalInfo
‪Info getAdditionalInfo()
Definition: Post.php:431
‪ExtbaseTeam\BlogExample\Domain\Model\Post\$blog
‪ExtbaseTeam BlogExample Domain Model Blog $blog
Definition: Post.php:26
‪ExtbaseTeam\BlogExample\Domain\Model\Post\__construct
‪__construct()
Definition: Post.php:92
‪ExtbaseTeam\BlogExample\Domain\Model\Post\setAdditionalComments
‪setAdditionalComments(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $additionalComments)
Definition: Post.php:455
‪ExtbaseTeam\BlogExample\Domain\Model\Blog
Definition: Blog.php:23
‪ExtbaseTeam\BlogExample\Domain\Model\Post\$tags
‪TYPO3 CMS Extbase Persistence ObjectStorage<\ExtbaseTeam\BlogExample\Domain\Model\Tag > $tags
Definition: Post.php:56
‪ExtbaseTeam\BlogExample\Domain\Model\Post
Definition: Post.php:23
‪ExtbaseTeam\BlogExample\Domain\Model\Comment
Definition: Comment.php:23
‪ExtbaseTeam\BlogExample\Domain\Model\Post\getDate
‪DateTime getDate()
Definition: Post.php:158
‪ExtbaseTeam\BlogExample\Domain\Model\Post\setContent
‪setContent($content)
Definition: Post.php:309
‪ExtbaseTeam\BlogExample\Domain\Model\Post\getAuthor
‪ExtbaseTeam BlogExample Domain Model Person getAuthor()
Definition: Post.php:267
‪ExtbaseTeam\BlogExample\Domain\Model\Post\addCategory
‪addCategory(\TYPO3\CMS\Extbase\Domain\Model\Category $category)
Definition: Post.php:217
‪ExtbaseTeam\BlogExample\Domain\Model\Post\setRelatedPosts
‪setRelatedPosts(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $relatedPosts)
Definition: Post.php:378
‪ExtbaseTeam\BlogExample\Domain\Model\Post\$reviewer
‪ExtbaseTeam BlogExample Domain Model Person $reviewer
Definition: Post.php:47
‪ExtbaseTeam\BlogExample\Domain\Model\Post\setSecondAuthor
‪setSecondAuthor(\ExtbaseTeam\BlogExample\Domain\Model\Person $secondAuthor)
Definition: Post.php:283
‪ExtbaseTeam\BlogExample\Domain\Model\Post\removeTag
‪removeTag(Tag $tag)
Definition: Post.php:188
‪ExtbaseTeam\BlogExample\Domain\Model\Person
Definition: Person.php:21
‪ExtbaseTeam\BlogExample\Domain\Model\Post\removeAllComments
‪removeAllComments()
Definition: Post.php:357
‪ExtbaseTeam\BlogExample\Domain\Model\Post\addTag
‪addTag(Tag $tag)
Definition: Post.php:178
‪ExtbaseTeam\BlogExample\Domain\Model\Post\setCategories
‪setCategories($categories)
Definition: Post.php:227
‪ExtbaseTeam\BlogExample\Domain\Model\Post\removeCategory
‪removeCategory(\TYPO3\CMS\Extbase\Domain\Model\Category $category)
Definition: Post.php:247
‪ExtbaseTeam\BlogExample\Domain\Model\Post\$comments
‪TYPO3 CMS Extbase Persistence ObjectStorage<\ExtbaseTeam\BlogExample\Domain\Model\Comment > $comments
Definition: Post.php:66
‪ExtbaseTeam\BlogExample\Domain\Model\Post\__toString
‪string __toString()
Definition: Post.php:490
‪ExtbaseTeam\BlogExample\Domain\Model\Post\$additionalName
‪ExtbaseTeam BlogExample Domain Model Info $additionalName
Definition: Post.php:76
‪ExtbaseTeam\BlogExample\Domain\Model
Definition: Administrator.php:3
‪ExtbaseTeam
‪ExtbaseTeam\BlogExample\Domain\Model\Post\getAdditionalComments
‪TYPO3 CMS Extbase Persistence ObjectStorage getAdditionalComments()
Definition: Post.php:447
‪ExtbaseTeam\BlogExample\Domain\Model\Post\removeAllRelatedPosts
‪removeAllRelatedPosts()
Definition: Post.php:396
‪ExtbaseTeam\BlogExample\Domain\Model\Post\setAuthor
‪setAuthor(\ExtbaseTeam\BlogExample\Domain\Model\Person $author)
Definition: Post.php:257
‪ExtbaseTeam\BlogExample\Domain\Model\Tag
Definition: Tag.php:21
‪ExtbaseTeam\BlogExample\Domain\Model\Post\removeAllTags
‪removeAllTags()
Definition: Post.php:196
‪ExtbaseTeam\BlogExample\Domain\Model\Post\$author
‪ExtbaseTeam BlogExample Domain Model Person $author
Definition: Post.php:39