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