[BUGFIX] Return null value instead of string 'NULL'
[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 /*
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
17 /**
18 * A blog
19 */
20 class Blog extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
21 {
22 /**
23 * The blog's title.
24 *
25 * @var string
26 * @validate StringLength(minimum = 1, maximum = 80)
27 */
28 protected $title = '';
29
30 /**
31 * The blog's subtitle
32 *
33 * @var string
34 */
35 protected $subtitle;
36
37 /**
38 * A short description of the blog
39 *
40 * @var string
41 * @validate StringLength(maximum = 150)
42 */
43 protected $description = '';
44
45 /**
46 * A relative path to a logo image
47 *
48 * @var string
49 */
50 protected $logo = '';
51
52 /**
53 * The posts of this blog
54 *
55 * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\ExtbaseTeam\BlogExample\Domain\Model\Post>
56 * @lazy
57 * @cascade remove
58 */
59 protected $posts = null;
60
61 /**
62 * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\Category>
63 */
64 protected $categories = null;
65
66 /**
67 * The blog's administrator
68 *
69 * @var \ExtbaseTeam\BlogExample\Domain\Model\Administrator
70 * @lazy
71 */
72 protected $administrator = null;
73
74 /**
75 * Constructs a new Blog
76 */
77 public function __construct()
78 {
79 $this->posts = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
80 }
81
82 /**
83 * @return string
84 */
85 public function getSubtitle()
86 {
87 return $this->subtitle;
88 }
89
90 /**
91 * Sets this blog's title
92 *
93 * @param string $title The blog's title
94 */
95 public function setTitle($title)
96 {
97 $this->title = $title;
98 }
99
100 /**
101 * Returns the blog's title
102 *
103 * @return string The blog's title
104 */
105 public function getTitle()
106 {
107 return $this->title;
108 }
109
110 /**
111 * @param string $logo
112 */
113 public function setLogo($logo)
114 {
115 $this->logo = $logo;
116 }
117
118 /**
119 * @return string
120 */
121 public function getLogo()
122 {
123 return $this->logo;
124 }
125
126 /**
127 * Sets the description for the blog
128 *
129 * @param string $description
130 */
131 public function setDescription($description)
132 {
133 $this->description = $description;
134 }
135
136 /**
137 * Returns the description
138 *
139 * @return string
140 */
141 public function getDescription()
142 {
143 return $this->description;
144 }
145
146 /**
147 * Adds a post to this blog
148 *
149 * @param Post $post
150 */
151 public function addPost(Post $post)
152 {
153 $this->posts->attach($post);
154 }
155
156 /**
157 * Remove a post from this blog
158 *
159 * @param Post $postToRemove The post to be removed
160 */
161 public function removePost(Post $postToRemove)
162 {
163 $this->posts->detach($postToRemove);
164 }
165
166 /**
167 * Remove all posts from this blog
168 */
169 public function removeAllPosts()
170 {
171 $this->posts = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
172 }
173
174 /**
175 * Returns all posts in this blog
176 *
177 * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage
178 */
179 public function getPosts()
180 {
181 return $this->posts;
182 }
183
184 /**
185 * Add category to a blog
186 *
187 * @param \TYPO3\CMS\Extbase\Domain\Model\Category $category
188 */
189 public function addCategory(\TYPO3\CMS\Extbase\Domain\Model\Category $category)
190 {
191 $this->categories->attach($category);
192 }
193
194 /**
195 * Set categories
196 *
197 * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $categories
198 */
199 public function setCategories($categories)
200 {
201 $this->categories = $categories;
202 }
203
204 /**
205 * Get categories
206 *
207 * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage
208 */
209 public function getCategories()
210 {
211 return $this->categories;
212 }
213
214 /**
215 * Remove category from blog
216 *
217 * @param \TYPO3\CMS\Extbase\Domain\Model\Category $category
218 */
219 public function removeCategory(\TYPO3\CMS\Extbase\Domain\Model\Category $category)
220 {
221 $this->categories->detach($category);
222 }
223
224 /**
225 * Sets the administrator value
226 *
227 * @param Administrator $administrator The Administrator of this Blog
228 */
229 public function setAdministrator(Administrator $administrator)
230 {
231 $this->administrator = $administrator;
232 }
233
234 /**
235 * Returns the administrator value
236 *
237 * @return Administrator
238 */
239 public function getAdministrator()
240 {
241 return $this->administrator;
242 }
243
244 /**
245 * @param ?string $subtitle
246 */
247 public function setSubtitle($subtitle)
248 {
249 $this->subtitle = $subtitle;
250 }
251 }