4cbce5e6826366f25f76432be6dfc6483d34dd0f
[Packages/TYPO3.CMS.git] / typo3 / sysext / documentation / Classes / Domain / Model / DocumentTranslation.php
1 <?php
2 namespace TYPO3\CMS\Documentation\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 * An extension helper model to be used in ext:documentation context
19 *
20 * @entity
21 */
22 class DocumentTranslation extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
23 {
24 /**
25 * language
26 * 2 char language identifier (or "" for default)
27 *
28 * @var string
29 * @validate NotEmpty
30 */
31 protected $language;
32
33 /**
34 * title
35 *
36 * @var string
37 */
38 protected $title;
39
40 /**
41 * description
42 *
43 * @var string
44 */
45 protected $description;
46
47 /**
48 * formats
49 *
50 * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Documentation\Domain\Model\DocumentFormat>
51 */
52 protected $formats;
53
54 /**
55 * Default constructor.
56 */
57 public function __construct()
58 {
59 // Do not remove the next line: It would break the functionality
60 $this->initStorageObjects();
61 }
62
63 /**
64 * Initializes all ObjectStorage properties.
65 */
66 protected function initStorageObjects()
67 {
68 /**
69 * Do not modify this method!
70 * It will be rewritten on each save in the extension builder
71 * You may modify the constructor of this class instead
72 */
73 $this->formats = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
74 }
75
76 /**
77 * Returns the language.
78 *
79 * @return string $language
80 */
81 public function getLanguage()
82 {
83 return $this->language;
84 }
85
86 /**
87 * Sets the language.
88 *
89 * @param string $language
90 * @return DocumentTranslation
91 */
92 public function setLanguage($language)
93 {
94 $this->language = $language;
95 return $this;
96 }
97
98 /**
99 * Returns the title.
100 *
101 * @return string $title
102 */
103 public function getTitle()
104 {
105 return $this->title;
106 }
107
108 /**
109 * Sets the title.
110 *
111 * @param string $title
112 * @return DocumentTranslation
113 */
114 public function setTitle($title)
115 {
116 $this->title = $title;
117 return $this;
118 }
119
120 /**
121 * Returns the description.
122 *
123 * @return string $description
124 */
125 public function getDescription()
126 {
127 return $this->description;
128 }
129
130 /**
131 * Sets the description.
132 *
133 * @param string $description
134 * @return DocumentTranslation
135 */
136 public function setDescription($description)
137 {
138 $this->description = $description;
139 return $this;
140 }
141
142 /**
143 * Adds a documentation format.
144 *
145 * @param \TYPO3\CMS\Documentation\Domain\Model\DocumentFormat $format
146 * @return DocumentTranslation
147 */
148 public function addFormat(\TYPO3\CMS\Documentation\Domain\Model\DocumentFormat $format)
149 {
150 $this->formats->attach($format);
151 return $this;
152 }
153
154 /**
155 * Removes a documentation format.
156 *
157 * @param \TYPO3\CMS\Documentation\Domain\Model\DocumentFormat $formatToRemove The DocumentFormat to be removed
158 * @return DocumentTranslation
159 */
160 public function removeFormat(\TYPO3\CMS\Documentation\Domain\Model\DocumentFormat $formatToRemove)
161 {
162 $this->formats->detach($formatToRemove);
163 return $this;
164 }
165
166 /**
167 * Returns the formats.
168 *
169 * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Documentation\Domain\Model\DocumentFormat> $formats
170 */
171 public function getFormats()
172 {
173 return $this->formats;
174 }
175
176 /**
177 * Sets the formats.
178 *
179 * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Documentation\Domain\Model\DocumentFormat> $formats
180 * @return DocumentTranslation
181 */
182 public function setFormats(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $formats)
183 {
184 $this->formats = $formats;
185 return $this;
186 }
187 }