[TASK] Streamline phpdoc annotations in EXT:extbase
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Classes / Persistence / Generic / Mapper / DataMap.php
1 <?php
2 namespace TYPO3\CMS\Extbase\Persistence\Generic\Mapper;
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 data map to map a single table configured in $TCA on a domain object.
19 * @internal only to be used within Extbase, not part of TYPO3 Core API.
20 */
21 class DataMap
22 {
23 /**
24 * The class name
25 *
26 * @var string
27 */
28 protected $className;
29
30 /**
31 * The table name corresponding to the domain class configured in $TCA
32 *
33 * @var string
34 */
35 protected $tableName;
36
37 /**
38 * The record type stored in the "type" field as configured in $TCA
39 *
40 * @var string
41 */
42 protected $recordType;
43
44 /**
45 * The subclasses of the current class
46 *
47 * @var array
48 */
49 protected $subclasses = [];
50
51 /**
52 * An array of column maps configured in $TCA
53 *
54 * @var array
55 */
56 protected $columnMaps = [];
57
58 /**
59 * @var string
60 */
61 protected $pageIdColumnName;
62
63 /**
64 * @var string
65 */
66 protected $languageIdColumnName;
67
68 /**
69 * @var string
70 */
71 protected $translationOriginColumnName;
72
73 /**
74 * @var string
75 */
76 protected $translationOriginDiffSourceName;
77
78 /**
79 * @var string
80 */
81 protected $modificationDateColumnName;
82
83 /**
84 * @var string
85 */
86 protected $creationDateColumnName;
87
88 /**
89 * @var string
90 */
91 protected $creatorColumnName;
92
93 /**
94 * @var string
95 */
96 protected $deletedFlagColumnName;
97
98 /**
99 * @var string
100 */
101 protected $disabledFlagColumnName;
102
103 /**
104 * @var string
105 */
106 protected $startTimeColumnName;
107
108 /**
109 * @var string
110 */
111 protected $endTimeColumnName;
112
113 /**
114 * @var string
115 */
116 protected $frontendUserGroupColumnName;
117
118 /**
119 * @var string
120 */
121 protected $recordTypeColumnName;
122
123 /**
124 * @var bool
125 */
126 protected $isStatic = false;
127
128 /**
129 * @var bool
130 */
131 protected $rootLevel = false;
132
133 /**
134 * Constructs this DataMap
135 *
136 * @param string $className The class name
137 * @param string $tableName The table name
138 * @param string $recordType The record type
139 * @param array $subclasses The subclasses
140 */
141 public function __construct($className, $tableName, $recordType = null, array $subclasses = [])
142 {
143 $this->setClassName($className);
144 $this->setTableName($tableName);
145 $this->setRecordType($recordType);
146 $this->setSubclasses($subclasses);
147 }
148
149 /**
150 * Sets the name of the class the column map represents
151 *
152 * @param string $className
153 */
154 public function setClassName($className)
155 {
156 $this->className = $className;
157 }
158
159 /**
160 * Returns the name of the class the column map represents
161 *
162 * @return string The class name
163 */
164 public function getClassName()
165 {
166 return $this->className;
167 }
168
169 /**
170 * Sets the name of the table the column map represents
171 *
172 * @param string $tableName
173 */
174 public function setTableName($tableName)
175 {
176 $this->tableName = $tableName;
177 }
178
179 /**
180 * Returns the name of the table the column map represents
181 *
182 * @return string The table name
183 */
184 public function getTableName()
185 {
186 return $this->tableName;
187 }
188
189 /**
190 * Sets the record type
191 *
192 * @param string $recordType The record type
193 */
194 public function setRecordType($recordType)
195 {
196 $this->recordType = $recordType;
197 }
198
199 /**
200 * Returns the record type
201 *
202 * @return string The record type
203 */
204 public function getRecordType()
205 {
206 return $this->recordType;
207 }
208
209 /**
210 * Sets the subclasses
211 *
212 * @param array $subclasses An array of subclasses
213 */
214 public function setSubclasses(array $subclasses)
215 {
216 $this->subclasses = $subclasses;
217 }
218
219 /**
220 * Returns the subclasses
221 *
222 * @return array The subclasses
223 */
224 public function getSubclasses()
225 {
226 return $this->subclasses;
227 }
228
229 /**
230 * Adds a given column map to the data map.
231 *
232 * @param \TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap $columnMap The column map
233 */
234 public function addColumnMap(ColumnMap $columnMap)
235 {
236 $this->columnMaps[$columnMap->getPropertyName()] = $columnMap;
237 }
238
239 /**
240 * Returns the column map corresponding to the given property name.
241 *
242 * @param string $propertyName
243 * @return \TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap|null The column map or NULL if no corresponding column map was found.
244 */
245 public function getColumnMap($propertyName)
246 {
247 return $this->columnMaps[$propertyName] ?? null;
248 }
249
250 /**
251 * Returns TRUE if the property is persistable (configured in $TCA)
252 *
253 * @param string $propertyName The property name
254 * @return bool TRUE if the property is persistable (configured in $TCA)
255 */
256 public function isPersistableProperty($propertyName)
257 {
258 return isset($this->columnMaps[$propertyName]);
259 }
260
261 /**
262 * Sets the name of a column holding the page id
263 *
264 * @param string $pageIdColumnName The field name
265 */
266 public function setPageIdColumnName($pageIdColumnName)
267 {
268 $this->pageIdColumnName = $pageIdColumnName;
269 }
270
271 /**
272 * Sets the name of a column holding the page id
273 *
274 * @return string The field name
275 */
276 public function getPageIdColumnName()
277 {
278 return $this->pageIdColumnName;
279 }
280
281 /**
282 * Sets the name of a column holding the language id of the record
283 *
284 * @param string $languageIdColumnName The field name
285 */
286 public function setLanguageIdColumnName($languageIdColumnName)
287 {
288 $this->languageIdColumnName = $languageIdColumnName;
289 }
290
291 /**
292 * Returns the name of a column holding the language id of the record.
293 *
294 * @return string The field name
295 */
296 public function getLanguageIdColumnName()
297 {
298 return $this->languageIdColumnName;
299 }
300
301 /**
302 * Sets the name of a column holding the the uid of the record which this record is a translation of.
303 *
304 * @param string $translationOriginColumnName The field name
305 */
306 public function setTranslationOriginColumnName($translationOriginColumnName)
307 {
308 $this->translationOriginColumnName = $translationOriginColumnName;
309 }
310
311 /**
312 * Returns the name of a column holding the the uid of the record which this record is a translation of.
313 *
314 * @return string The field name
315 */
316 public function getTranslationOriginColumnName()
317 {
318 return $this->translationOriginColumnName;
319 }
320
321 /**
322 * Sets the name of a column holding the the diff data for the record which this record is a translation of.
323 *
324 * @param string $translationOriginDiffSourceName The field name
325 */
326 public function setTranslationOriginDiffSourceName($translationOriginDiffSourceName)
327 {
328 $this->translationOriginDiffSourceName = $translationOriginDiffSourceName;
329 }
330
331 /**
332 * Returns the name of a column holding the diff data for the record which this record is a translation of.
333 *
334 * @return string The field name
335 */
336 public function getTranslationOriginDiffSourceName()
337 {
338 return $this->translationOriginDiffSourceName;
339 }
340
341 /**
342 * Sets the name of a column holding the timestamp the record was modified
343 *
344 * @param string $modificationDateColumnName The field name
345 */
346 public function setModificationDateColumnName($modificationDateColumnName)
347 {
348 $this->modificationDateColumnName = $modificationDateColumnName;
349 }
350
351 /**
352 * Returns the name of a column holding the timestamp the record was modified
353 *
354 * @return string The field name
355 */
356 public function getModificationDateColumnName()
357 {
358 return $this->modificationDateColumnName;
359 }
360
361 /**
362 * Sets the name of a column holding the creation date timestamp
363 *
364 * @param string $creationDateColumnName The field name
365 */
366 public function setCreationDateColumnName($creationDateColumnName)
367 {
368 $this->creationDateColumnName = $creationDateColumnName;
369 }
370
371 /**
372 * Returns the name of a column holding the creation date timestamp
373 *
374 * @return string The field name
375 */
376 public function getCreationDateColumnName()
377 {
378 return $this->creationDateColumnName;
379 }
380
381 /**
382 * Sets the name of a column holding the uid of the back-end user who created this record
383 *
384 * @param string $creatorColumnName The field name
385 */
386 public function setCreatorColumnName($creatorColumnName)
387 {
388 $this->creatorColumnName = $creatorColumnName;
389 }
390
391 /**
392 * Returns the name of a column holding the uid of the back-end user who created this record
393 *
394 * @return string The field name
395 */
396 public function getCreatorColumnName()
397 {
398 return $this->creatorColumnName;
399 }
400
401 /**
402 * Sets the name of a column indicating the 'deleted' state of the row
403 *
404 * @param string $deletedFlagColumnName The field name
405 */
406 public function setDeletedFlagColumnName($deletedFlagColumnName)
407 {
408 $this->deletedFlagColumnName = $deletedFlagColumnName;
409 }
410
411 /**
412 * Returns the name of a column indicating the 'deleted' state of the row
413 *
414 * @return string The field name
415 */
416 public function getDeletedFlagColumnName()
417 {
418 return $this->deletedFlagColumnName;
419 }
420
421 /**
422 * Sets the name of a column indicating the 'hidden' state of the row
423 *
424 * @param string $disabledFlagColumnName The field name
425 */
426 public function setDisabledFlagColumnName($disabledFlagColumnName)
427 {
428 $this->disabledFlagColumnName = $disabledFlagColumnName;
429 }
430
431 /**
432 * Returns the name of a column indicating the 'hidden' state of the row
433 *
434 * @return string The field name
435 */
436 public function getDisabledFlagColumnName()
437 {
438 return $this->disabledFlagColumnName;
439 }
440
441 /**
442 * Sets the name of a column holding the timestamp the record should not displayed before
443 *
444 * @param string $startTimeColumnName The field name
445 */
446 public function setStartTimeColumnName($startTimeColumnName)
447 {
448 $this->startTimeColumnName = $startTimeColumnName;
449 }
450
451 /**
452 * Returns the name of a column holding the timestamp the record should not displayed before
453 *
454 * @return string The field name
455 */
456 public function getStartTimeColumnName()
457 {
458 return $this->startTimeColumnName;
459 }
460
461 /**
462 * Sets the name of a column holding the timestamp the record should not displayed afterwards
463 *
464 * @param string $endTimeColumnName The field name
465 */
466 public function setEndTimeColumnName($endTimeColumnName)
467 {
468 $this->endTimeColumnName = $endTimeColumnName;
469 }
470
471 /**
472 * Returns the name of a column holding the timestamp the record should not displayed afterwards
473 *
474 * @return string The field name
475 */
476 public function getEndTimeColumnName()
477 {
478 return $this->endTimeColumnName;
479 }
480
481 /**
482 * Sets the name of a column holding the uid of the front-end user group which is allowed to edit this record
483 *
484 * @param string $frontendUserGroupColumnName The field name
485 */
486 public function setFrontEndUserGroupColumnName($frontendUserGroupColumnName)
487 {
488 $this->frontendUserGroupColumnName = $frontendUserGroupColumnName;
489 }
490
491 /**
492 * Returns the name of a column holding the uid of the front-end user group which is allowed to edit this record
493 *
494 * @return string The field name
495 */
496 public function getFrontEndUserGroupColumnName()
497 {
498 return $this->frontendUserGroupColumnName;
499 }
500
501 /**
502 * Sets the name of a column holding the record type
503 *
504 * @param string $recordTypeColumnName The field name
505 */
506 public function setRecordTypeColumnName($recordTypeColumnName)
507 {
508 $this->recordTypeColumnName = $recordTypeColumnName;
509 }
510
511 /**
512 * Sets the name of a column holding the record type
513 *
514 * @return string The field name
515 */
516 public function getRecordTypeColumnName()
517 {
518 return $this->recordTypeColumnName;
519 }
520
521 /**
522 * @param bool $isStatic
523 */
524 public function setIsStatic($isStatic)
525 {
526 $this->isStatic = $isStatic;
527 }
528
529 /**
530 * @return bool
531 */
532 public function getIsStatic()
533 {
534 return $this->isStatic;
535 }
536
537 /**
538 * @param bool $rootLevel
539 */
540 public function setRootLevel($rootLevel)
541 {
542 $this->rootLevel = $rootLevel;
543 }
544
545 /**
546 * @return bool
547 */
548 public function getRootLevel()
549 {
550 return $this->rootLevel;
551 }
552 }