[FEATURE] Show extension keys in documentation list
[Packages/TYPO3.CMS.git] / typo3 / sysext / documentation / Classes / Domain / Model / Document.php
1 <?php
2 namespace TYPO3\CMS\Documentation\Domain\Model;
3
4 /***************************************************************
5 * Copyright notice
6 *
7 * (c) 2013 Andrea Schmuttermair <spam@schmutt.de>
8 * All rights reserved
9 *
10 * This script is part of the TYPO3 project. The TYPO3 project is
11 * free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 3 of the License, or
14 * (at your option) any later version.
15 *
16 * The GNU General Public License can be found at
17 * http://www.gnu.org/copyleft/gpl.html.
18 *
19 * This script is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * This copyright notice MUST APPEAR in all copies of the script!
25 ***************************************************************/
26
27 /**
28 * An extension helper model to be used in ext:documentation context
29 *
30 * @entity
31 * @author Andrea Schmuttermair <spam@schmutt.de>
32 */
33 class Document extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
34
35 /**
36 * packageKey
37 *
38 * @var string
39 * @validate NotEmpty
40 */
41 protected $packageKey;
42
43 /**
44 * extensionKey
45 *
46 * @var string
47 * @validate NotEmpty
48 */
49 protected $extensionKey;
50
51 /**
52 * icon
53 *
54 * @var string
55 */
56 protected $icon;
57
58 /**
59 * translations
60 *
61 * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Documentation\Domain\Model\DocumentTranslation>
62 */
63 protected $translations;
64
65 /**
66 * Default constructor.
67 */
68 public function __construct() {
69 // Do not remove the next line: It would break the functionality
70 $this->initStorageObjects();
71 }
72
73 /**
74 * Initializes all ObjectStorage properties.
75 *
76 * @return void
77 */
78 protected function initStorageObjects() {
79 /**
80 * Do not modify this method!
81 * It will be rewritten on each save in the extension builder
82 * You may modify the constructor of this class instead
83 */
84 $this->translations = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
85 }
86
87 /**
88 * Returns the package key.
89 *
90 * @return string $packageKey
91 */
92 public function getPackageKey() {
93 return $this->packageKey;
94 }
95
96 /**
97 * Sets the package key.
98 *
99 * @param string $packageKey
100 * @return Document
101 */
102 public function setPackageKey($packageKey) {
103 $this->packageKey = $packageKey;
104 return $this;
105 }
106
107 /**
108 * Returns the extension key.
109 *
110 * @return string $extensionKey
111 */
112 public function getExtensionKey() {
113 return $this->extensionKey;
114 }
115
116 /**
117 * Sets the extension key.
118 *
119 * @param string $extensionKey
120 * @return Document
121 */
122 public function setExtensionKey($extensionKey) {
123 $this->extensionKey = $extensionKey;
124 return $this;
125 }
126
127 /**
128 * Returns the icon.
129 *
130 * @return string $icon
131 */
132 public function getIcon() {
133 return $this->icon;
134 }
135
136 /**
137 * Sets the icon.
138 *
139 * @param string $icon
140 * @return Document
141 */
142 public function setIcon($icon) {
143 $this->icon = $icon;
144 return $this;
145 }
146
147 /**
148 * Adds a document translation.
149 *
150 * @param \TYPO3\CMS\Documentation\Domain\Model\DocumentTranslation $translation
151 * @return Document
152 */
153 public function addTranslation(\TYPO3\CMS\Documentation\Domain\Model\DocumentTranslation $translation) {
154 $this->translations->attach($translation);
155 return $this;
156 }
157
158 /**
159 * Removes a document translation.
160 *
161 * @param \TYPO3\CMS\Documentation\Domain\Model\DocumentTranslation $translationToRemove The DocumentTranslation to be removed
162 * @return Document
163 */
164 public function removeTranslation(\TYPO3\CMS\Documentation\Domain\Model\DocumentTranslation $translationToRemove) {
165 $this->translations->detach($translationToRemove);
166 return $this;
167 }
168
169 /**
170 * Returns the translations.
171 *
172 * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Documentation\Domain\Model\DocumentTranslation> $translations
173 */
174 public function getTranslations() {
175 return $this->translations;
176 }
177
178 /**
179 * Sets the translations.
180 *
181 * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Documentation\Domain\Model\DocumentTranslation> $translations
182 * @return Document
183 */
184 public function setTranslations(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $translations) {
185 $this->translations = $translations;
186 return $this;
187 }
188
189 }