|
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 column map to map a column configured in $TCA on a property of a domain object. 00027 * 00028 * @package Extbase 00029 * @subpackage Persistence\Mapper 00030 * @version $ID:$ 00031 */ 00032 // SK: PHPDoc ;-) 00033 class Tx_Extbase_Persistence_Mapper_ColumnMap { 00034 00035 /** 00036 * Constants reflecting the type of relation 00037 */ 00038 const RELATION_NONE = 'RELATION_NONE'; 00039 const RELATION_HAS_ONE = 'RELATION_HAS_ONE'; 00040 const RELATION_HAS_MANY = 'RELATION_HAS_MANY'; 00041 const RELATION_BELONGS_TO_MANY = 'RELATION_BELONGS_TO_MANY'; 00042 const RELATION_HAS_AND_BELONGS_TO_MANY = 'RELATION_HAS_AND_BELONGS_TO_MANY'; 00043 00044 /** 00045 * Constants reflecting how the relation information is stored 00046 */ 00047 const RELATION_PARENT_FOREIGN_KEY = 'RELATION_PARENT_FOREIGN_KEY'; 00048 const RELATION_CHILD_FOREIGN_KEY = 'RELATION_CHILD_FOREIGN_KEY'; 00049 const RELATION_PARENT_CSV = 'RELATION_PARENT_CSV'; 00050 const RELATION_INTERMEDIATE_TABLE = 'RELATION_INTERMEDIATE_TABLE'; 00051 00052 /** 00053 * Constants reflecting the loading strategy 00054 */ 00055 const STRATEGY_EAGER = 'eager'; 00056 const STRATEGY_LAZY_PROXY = 'proxy'; 00057 const STRATEGY_LAZY_STORAGE = 'storage'; 00058 00059 /** 00060 * The property name corresponding to the table name 00061 * 00062 * @var string 00063 **/ 00064 protected $propertyName; 00065 00066 /** 00067 * The column name 00068 * 00069 * @var string 00070 **/ 00071 protected $columnName; 00072 00073 /** 00074 * The type of relation 00075 * 00076 * @var int 00077 **/ 00078 protected $typeOfRelation; 00079 00080 /** 00081 * The name of the child's class 00082 * 00083 * @var string 00084 **/ 00085 protected $childClassName; 00086 00087 /** 00088 * The name of the child's table 00089 * 00090 * @var string 00091 **/ 00092 protected $childTableName; 00093 00094 /** 00095 * The where clause to narrow down the selected child records 00096 * 00097 * @var string 00098 **/ 00099 protected $childTableWhereStatement; 00100 00101 /** 00102 * The name of the field the results from the child's table are sorted by 00103 * 00104 * @var string 00105 **/ 00106 protected $childSortByFieldName; 00107 00108 /** 00109 * The name of the relation table 00110 * 00111 * @var string 00112 **/ 00113 protected $relationTableName; 00114 00115 /** 00116 * The name of the column of the relation table holding the page id 00117 * 00118 * @var string 00119 **/ 00120 protected $relationTablePageIdColumnName; 00121 00122 /** 00123 * An array of field => value pairs to both insert and match against when writing/reading MM relations 00124 * 00125 * @var array 00126 **/ 00127 protected $relationTableMatchFields; 00128 00129 /** 00130 * Array of field=>value pairs to insert when writing new MM relations 00131 * 00132 * @var array 00133 **/ 00134 protected $relationTableInsertFields; 00135 00136 /** 00137 * The where clause to narrow down the selected relation table records 00138 * 00139 * @var string 00140 **/ 00141 protected $relationTableWhereStatement; 00142 00143 /** 00144 * The name of the field holding the parents key 00145 * 00146 * @var string 00147 **/ 00148 protected $parentKeyFieldName; 00149 00150 /** 00151 * The name of the field holding the name of the table of the parent's records 00152 * 00153 * @var string 00154 **/ 00155 protected $parentTableFieldName; 00156 00157 /** 00158 * The name of the field holding the children key 00159 * 00160 * @var string 00161 **/ 00162 protected $childKeyFieldName; 00163 00164 /** 00165 * Constructs a Column Map 00166 * 00167 * @param string $columnName The column name 00168 * @param string $propertyName The property name 00169 * @return void 00170 */ 00171 public function __construct($columnName, $propertyName) { 00172 // TODO Enable aliases (tx_anotherextension_addedcolumn -> theAddedColumn) 00173 $this->setColumnName($columnName); 00174 $this->setPropertyName($propertyName); 00175 } 00176 00177 public function setTypeOfRelation($typeOfRelation) { 00178 $this->typeOfRelation = $typeOfRelation; 00179 } 00180 00181 public function getTypeOfRelation() { 00182 return $this->typeOfRelation; 00183 } 00184 00185 public function setPropertyName($propertyName) { 00186 $this->propertyName = $propertyName; 00187 } 00188 00189 public function getPropertyName() { 00190 return $this->propertyName; 00191 } 00192 00193 public function setColumnName($columnName) { 00194 $this->columnName = $columnName; 00195 } 00196 00197 public function getColumnName() { 00198 return $this->columnName; 00199 } 00200 00201 public function setChildTableName($childTableName) { 00202 $this->childTableName = $childTableName; 00203 } 00204 00205 public function getChildTableName() { 00206 return $this->childTableName; 00207 } 00208 00209 public function setChildTableWhereStatement($childTableWhereStatement) { 00210 $this->childTableWhereStatement = $childTableWhereStatement; 00211 } 00212 00213 public function getChildTableWhereStatement() { 00214 return $this->childTableWhereStatement; 00215 } 00216 00217 public function setChildSortByFieldName($childSortByFieldName) { 00218 $this->childSortByFieldName = $childSortByFieldName; 00219 } 00220 00221 public function getChildSortByFieldName() { 00222 return $this->childSortByFieldName; 00223 } 00224 00225 public function setRelationTableName($relationTableName) { 00226 $this->relationTableName = $relationTableName; 00227 } 00228 00229 public function getRelationTableName() { 00230 return $this->relationTableName; 00231 } 00232 00233 public function setRelationTablePageIdColumnName($relationTablePageIdColumnName) { 00234 $this->relationTablePageIdColumnName = $relationTablePageIdColumnName; 00235 } 00236 00237 public function getRelationTablePageIdColumnName() { 00238 return $this->relationTablePageIdColumnName; 00239 } 00240 00241 public function setRelationTableMatchFields(array $relationTableMatchFields) { 00242 $this->relationTableMatchFields = $relationTableMatchFields; 00243 } 00244 00245 public function getRelationTableMatchFields() { 00246 return $this->relationTableMatchFields; 00247 } 00248 00249 public function setRelationTableInsertFields(array $relationTableInsertFields) { 00250 $this->relationTableInsertFields = $relationTableInsertFields; 00251 } 00252 00253 public function getRelationTableInsertFields() { 00254 return $this->relationTableInsertFields; 00255 } 00256 00257 public function setRelationTableWhereStatement($relationTableWhereStatement) { 00258 $this->relationTableWhereStatement = $relationTableWhereStatement; 00259 } 00260 00261 public function getRelationTableWhereStatement() { 00262 return $this->relationTableWhereStatement; 00263 } 00264 00265 public function setParentKeyFieldName($parentKeyFieldName) { 00266 $this->parentKeyFieldName = $parentKeyFieldName; 00267 } 00268 00269 public function getParentKeyFieldName() { 00270 return $this->parentKeyFieldName; 00271 } 00272 00273 public function setParentTableFieldName($parentTableFieldName) { 00274 $this->parentTableFieldName = $parentTableFieldName; 00275 } 00276 00277 public function getParentTableFieldName() { 00278 return $this->parentTableFieldName; 00279 } 00280 00281 public function setChildKeyFieldName($childKeyFieldName) { 00282 $this->childKeyFieldName = $childKeyFieldName; 00283 } 00284 00285 public function getChildKeyFieldName() { 00286 return $this->childKeyFieldName; 00287 } 00288 00289 } 00290 ?>
1.8.0