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