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