28b4b95ea1a0a467d998c2791a3ab4d0f968f27c
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Tests / Functional / Fixtures / Extensions / blog_example / Classes / Domain / Model / Blog.php
1 <?php
2 namespace ExtbaseTeam\BlogExample\Domain\Model;
3 /**
4 * This file is part of the TYPO3 CMS project.
5 *
6 * It is free software; you can redistribute it and/or modify it under
7 * the terms of the GNU General Public License, either version 2
8 * of the License, or any later version.
9 *
10 * For the full copyright and license information, please read the
11 * LICENSE.txt file that was distributed with this source code.
12 *
13 * The TYPO3 project - inspiring people to share!
14 */
15
16 /**
17 * A blog
18 */
19 class Blog extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
20
21 /**
22 * The blog's title.
23 *
24 * @var string
25 * @validate StringLength(minimum = 1, maximum = 80)
26 */
27 protected $title = '';
28
29 /**
30 * A short description of the blog
31 *
32 * @var string
33 * @validate StringLength(maximum = 150)
34 */
35 protected $description = '';
36
37 /**
38 * A relative path to a logo image
39 *
40 * @var string
41 */
42 protected $logo = '';
43
44 /**
45 * The posts of this blog
46 *
47 * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\ExtbaseTeam\BlogExample\Domain\Model\Post>
48 * @lazy
49 * @cascade remove
50 */
51 protected $posts = NULL;
52
53 /**
54 * The blog's administrator
55 *
56 * @var \ExtbaseTeam\BlogExample\Domain\Model\Administrator
57 * @lazy
58 */
59 protected $administrator = NULL;
60
61 /**
62 * Constructs a new Blog
63 *
64 */
65 public function __construct() {
66 $this->posts = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
67 }
68
69 /**
70 * Sets this blog's title
71 *
72 * @param string $title The blog's title
73 * @return void
74 */
75 public function setTitle($title) {
76 $this->title = $title;
77 }
78
79 /**
80 * Returns the blog's title
81 *
82 * @return string The blog's title
83 */
84 public function getTitle() {
85 return $this->title;
86 }
87
88 /**
89 * @param string $logo
90 * @return void
91 */
92 public function setLogo($logo) {
93 $this->logo = $logo;
94 }
95
96 /**
97 * @return string
98 */
99 public function getLogo() {
100 return $this->logo;
101 }
102
103 /**
104 * Sets the description for the blog
105 *
106 * @param string $description
107 * @return void
108 */
109 public function setDescription($description) {
110 $this->description = $description;
111 }
112
113 /**
114 * Returns the description
115 *
116 * @return string
117 */
118 public function getDescription() {
119 return $this->description;
120 }
121
122 /**
123 * Adds a post to this blog
124 *
125 * @param Post $post
126 * @return void
127 */
128 public function addPost(Post $post) {
129 $this->posts->attach($post);
130 }
131
132 /**
133 * Remove a post from this blog
134 *
135 * @param Post $postToRemove The post to be removed
136 * @return void
137 */
138 public function removePost(Post $postToRemove) {
139 $this->posts->detach($postToRemove);
140 }
141
142 /**
143 * Remove all posts from this blog
144 *
145 * @return void
146 */
147 public function removeAllPosts() {
148 $this->posts = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
149 }
150
151 /**
152 * Returns all posts in this blog
153 *
154 * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage
155 */
156 public function getPosts() {
157 return $this->posts;
158 }
159
160 /**
161 * Sets the administrator value
162 *
163 * @param Administrator $administrator The Administrator of this Blog
164 * @return void
165 */
166 public function setAdministrator(Administrator $administrator) {
167 $this->administrator = $administrator;
168 }
169
170 /**
171 * Returns the administrator value
172 *
173 * @return Administrator
174 */
175 public function getAdministrator() {
176 return $this->administrator;
177 }
178
179 }