|
TYPO3 API
SVNRelease
|
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 2009 Jochen Rau <jochen.rau@typoplanet.de> 00006 * All rights reserved 00007 * 00008 * This script is part of the TYPO3 project. The TYPO3 project is 00009 * free software; you can redistribute it and/or modify 00010 * it under the terms of the GNU General Public License as published by 00011 * the Free Software Foundation; either version 2 of the License, or 00012 * (at your option) any later version. 00013 * 00014 * The GNU General Public License can be found at 00015 * http://www.gnu.org/copyleft/gpl.html. 00016 * 00017 * This script is distributed in the hope that it will be useful, 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 * GNU General Public License for more details. 00021 * 00022 * This copyright notice MUST APPEAR in all copies of the script! 00023 ***************************************************************/ 00024 00025 /** 00026 * A data map to map a single table configured in $TCA on a domain object. 00027 * 00028 * @package Extbase 00029 * @subpackage Persistence\Mapper 00030 * @version $ID:$ 00031 */ 00032 class Tx_Extbase_Persistence_Mapper_DataMap { 00033 00034 /** 00035 * The class name 00036 * 00037 * @var string 00038 **/ 00039 protected $className; 00040 00041 /** 00042 * The table name corresponding to the domain class configured in $TCA 00043 * 00044 * @var string 00045 **/ 00046 protected $tableName; 00047 00048 /** 00049 * The record type stored in the "type" field as configured in $TCA 00050 * 00051 * @var string 00052 **/ 00053 protected $recordType; 00054 00055 /** 00056 * The subclasses of the current class 00057 * 00058 * @var array 00059 **/ 00060 protected $subclasses = array(); 00061 00062 /** 00063 * An array of column maps configured in $TCA 00064 * 00065 * @var array 00066 **/ 00067 protected $columnMaps = array(); 00068 00069 /** 00070 * @var string 00071 **/ 00072 protected $pageIdColumnName; 00073 00074 /** 00075 * @var string 00076 **/ 00077 protected $languageIdColumnName; 00078 00079 /** 00080 * @var string 00081 **/ 00082 protected $translationOriginColumnName; 00083 00084 /** 00085 * @var string 00086 **/ 00087 protected $modificationDateColumnName; 00088 00089 /** 00090 * @var string 00091 **/ 00092 protected $creationDateColumnName; 00093 00094 /** 00095 * @var string 00096 **/ 00097 protected $creatorColumnName; 00098 00099 /** 00100 * @var string 00101 **/ 00102 protected $deletedFlagColumnName; 00103 00104 /** 00105 * @var string 00106 **/ 00107 protected $disabledFlagColumnName; 00108 00109 /** 00110 * @var string 00111 **/ 00112 protected $startTimeColumnName; 00113 00114 /** 00115 * @var string 00116 **/ 00117 protected $endTimeColumnName; 00118 00119 /** 00120 * @var string 00121 **/ 00122 protected $frontendUserGroupColumnName; 00123 00124 /** 00125 * @var string 00126 **/ 00127 protected $recordTypeColumnName; 00128 00129 /** 00130 * Constructs this DataMap 00131 * 00132 * @param string $className The class name 00133 * @param string $tableName The table name 00134 * @param string $recordType The record type 00135 * @param array $subclasses The subclasses 00136 */ 00137 public function __construct($className, $tableName, $recordType = NULL, array $subclasses = array()) { 00138 $this->setClassName($className); 00139 $this->setTableName($tableName); 00140 $this->setRecordType($recordType); 00141 $this->setSubclasses($subclasses); 00142 } 00143 00144 /** 00145 * Sets the name of the class the colum map represents 00146 * 00147 * @return void 00148 */ 00149 public function setClassName($className) { 00150 $this->className = $className; 00151 } 00152 00153 /** 00154 * Returns the name of the class the column map represents 00155 * 00156 * @return string The class name 00157 */ 00158 public function getClassName() { 00159 return $this->className; 00160 } 00161 00162 /** 00163 * Sets the name of the table the colum map represents 00164 * 00165 * @return void 00166 */ 00167 public function setTableName($tableName) { 00168 $this->tableName = $tableName; 00169 } 00170 00171 /** 00172 * Returns the name of the table the column map represents 00173 * 00174 * @return string The table name 00175 */ 00176 public function getTableName() { 00177 return $this->tableName; 00178 } 00179 00180 /** 00181 * Sets the record type 00182 * 00183 * @param string $recordType The record type 00184 * @return void 00185 */ 00186 public function setRecordType($recordType) { 00187 $this->recordType = $recordType; 00188 } 00189 00190 /** 00191 * Returns the record type 00192 * 00193 * @return string The record type 00194 */ 00195 public function getRecordType() { 00196 return $this->recordType; 00197 } 00198 00199 /** 00200 * Sets the subclasses 00201 * 00202 * @param array $subclasses An array of subclasses 00203 * @return void 00204 */ 00205 public function setSubclasses(array $subclasses) { 00206 $this->subclasses = $subclasses; 00207 } 00208 00209 /** 00210 * Returns the subclasses 00211 * 00212 * @return array The subclasses 00213 */ 00214 public function getSubclasses() { 00215 return $this->subclasses; 00216 } 00217 00218 /** 00219 * Adds a given column map to the data map. 00220 * 00221 * @param Tx_Extbase_Persistence_Mapper_ColumnMap $columnMap The column map 00222 * @return void 00223 */ 00224 public function addColumnMap(Tx_Extbase_Persistence_Mapper_ColumnMap $columnMap) { 00225 $this->columnMaps[$columnMap->getPropertyName()] = $columnMap; 00226 } 00227 00228 /** 00229 * Returns the column map corresponding to the given property name. 00230 * 00231 * @param string $propertyName 00232 * @return Tx_Extbase_Persistence_Mapper_ColumnMap|NULL The column map or NULL if no corresponding column map was found. 00233 */ 00234 public function getColumnMap($propertyName) { 00235 return $this->columnMaps[$propertyName]; 00236 } 00237 00238 /** 00239 * Returns TRUE if the property is persistable (configured in $TCA) 00240 * 00241 * @param string $propertyName The property name 00242 * @return boolean TRUE if the property is persistable (configured in $TCA) 00243 */ 00244 public function isPersistableProperty($propertyName) { 00245 return isset($this->columnMaps[$propertyName]); 00246 } 00247 00248 00249 /** 00250 * Sets the name of a column holding the page id 00251 * 00252 * @param string The field name 00253 * @return void 00254 */ 00255 public function setPageIdColumnName($pageIdColumnName) { 00256 $this->pageIdColumnName = $pageIdColumnName; 00257 } 00258 00259 /** 00260 * Sets the name of a column holding the page id 00261 * 00262 * @return string The field name 00263 */ 00264 public function getPageIdColumnName() { 00265 return $this->pageIdColumnName; 00266 } 00267 00268 /** 00269 * Sets the name of a column holding the language id of the record 00270 * 00271 * @param string $languageIdColumnName The field name 00272 * @return void 00273 */ 00274 public function setLanguageIdColumnName($languageIdColumnName) { 00275 $this->languageIdColumnName = $languageIdColumnName; 00276 } 00277 00278 /** 00279 * Returns the name of a column holding the language id of the record. 00280 * 00281 * @return string The field name 00282 */ 00283 public function getLanguageIdColumnName() { 00284 return $this->languageIdColumnName; 00285 } 00286 00287 /** 00288 * Sets the name of a column holding the the uid of the record which this record is a translation of. 00289 * 00290 * @param string $translationOriginColumnName The field name 00291 * @return void 00292 */ 00293 public function setTranslationOriginColumnName($translationOriginColumnName) { 00294 $this->translationOriginColumnName = $translationOriginColumnName; 00295 } 00296 00297 /** 00298 * Returns the name of a column holding the the uid of the record which this record is a translation of. 00299 * 00300 * @return string The field name 00301 */ 00302 public function getTranslationOriginColumnName() { 00303 return $this->translationOriginColumnName; 00304 } 00305 00306 /** 00307 * Sets the name of a column holding the timestamp the record was modified 00308 * 00309 * @param string The field name 00310 * @return void 00311 */ 00312 public function setModificationDateColumnName($modificationDateColumnName) { 00313 $this->modificationDateColumnName = $modificationDateColumnName; 00314 } 00315 00316 /** 00317 * Returns the name of a column holding the timestamp the record was modified 00318 * 00319 * @return string The field name 00320 */ 00321 public function getModificationDateColumnName() { 00322 return $this->modificationDateColumnName; 00323 } 00324 00325 /** 00326 * Sets the name of a column holding the creation date timestamp 00327 * 00328 * @param string The field name 00329 * @return void 00330 */ 00331 public function setCreationDateColumnName($creationDateColumnName) { 00332 $this->creationDateColumnName = $creationDateColumnName; 00333 } 00334 00335 /** 00336 * Returns the name of a column holding the creation date timestamp 00337 * 00338 * @return string The field name 00339 */ 00340 public function getCreationDateColumnName() { 00341 return $this->creationDateColumnName; 00342 } 00343 00344 /** 00345 * Sets the name of a column holding the uid of the back-end user who created this record 00346 * 00347 * @param string The field name 00348 * @return void 00349 */ 00350 public function setCreatorColumnName($creatorColumnName) { 00351 $this->creatorColumnName = $creatorColumnName; 00352 } 00353 00354 /** 00355 * Returns the name of a column holding the uid of the back-end user who created this record 00356 * 00357 * @return string The field name 00358 */ 00359 public function getCreatorColumnName() { 00360 return $this->creatorColumnName; 00361 } 00362 00363 /** 00364 * Sets the name of a column indicating the 'deleted' state of the row 00365 * 00366 * @param string The field name 00367 * @return void 00368 */ 00369 public function setDeletedFlagColumnName($deletedFlagColumnName) { 00370 $this->deletedFlagColumnName = $deletedFlagColumnName; 00371 } 00372 00373 /** 00374 * Returns the name of a column indicating the 'deleted' state of the row 00375 * 00376 * @return string The field name 00377 */ 00378 public function getDeletedFlagColumnName() { 00379 return $this->deletedFlagColumnName; 00380 } 00381 00382 /** 00383 * Sets the name of a column indicating the 'hidden' state of the row 00384 * 00385 * @param string The field name 00386 * @return void 00387 */ 00388 public function setDisabledFlagColumnName($disabledFlagColumnName) { 00389 $this->disabledFlagColumnName = $disabledFlagColumnName; 00390 } 00391 00392 /** 00393 * Returns the name of a column indicating the 'hidden' state of the row 00394 * 00395 * @return string The field name 00396 */ 00397 public function getDisabledFlagColumnName() { 00398 return $this->disabledFlagColumnName; 00399 } 00400 00401 /** 00402 * Sets the name of a column holding the timestamp the record should not displayed before 00403 * 00404 * @param string The field name 00405 * @return void 00406 */ 00407 public function setStartTimeColumnName($startTimeColumnName) { 00408 $this->startTimeColumnName = $startTimeColumnName; 00409 } 00410 00411 /** 00412 * Returns the name of a column holding the timestamp the record should not displayed before 00413 * 00414 * @return string The field name 00415 */ 00416 public function getStartTimeColumnName() { 00417 return $this->startTimeColumnName; 00418 } 00419 00420 /** 00421 * Sets the name of a column holding the timestamp the record should not displayed afterwards 00422 * 00423 * @param string The field name 00424 * @return void 00425 */ 00426 public function setEndTimeColumnName($endTimeColumnName) { 00427 $this->endTimeColumnName = $endTimeColumnName; 00428 } 00429 00430 /** 00431 * Returns the name of a column holding the timestamp the record should not displayed afterwards 00432 * 00433 * @return string The field name 00434 */ 00435 public function getEndTimeColumnName() { 00436 return $this->endTimeColumnName; 00437 } 00438 00439 /** 00440 * Sets the name of a column holding the uid of the front-end user group which is allowed to edit this record 00441 * 00442 * @param string The field name 00443 * @return void 00444 */ 00445 public function setFrontEndUserGroupColumnName($frontendUserGroupColumnName) { 00446 $this->frontendUserGroupColumnName = $frontendUserGroupColumnName; 00447 } 00448 00449 /** 00450 * Returns the name of a column holding the uid of the front-end user group which is allowed to edit this record 00451 * 00452 * @return string The field name 00453 */ 00454 public function getFrontEndUserGroupColumnName() { 00455 return $this->frontendUserGroupColumnName; 00456 } 00457 00458 /** 00459 * Sets the name of a column holding the record type 00460 * 00461 * @param string $recordTypeColumnName The field name 00462 * @return void 00463 */ 00464 public function setRecordTypeColumnName($recordTypeColumnName) { 00465 $this->recordTypeColumnName = $recordTypeColumnName; 00466 } 00467 00468 /** 00469 * Sets the name of a column holding the record type 00470 * 00471 * @return string The field name 00472 */ 00473 public function getRecordTypeColumnName() { 00474 return $this->recordTypeColumnName; 00475 } 00476 00477 }
1.8.0