Raised DBAL version from 1.1.5 to 1.1.6
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Classes / Persistence / Mapper / ColumnMap.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 *
17 * This script is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * This copyright notice MUST APPEAR in all copies of the script!
23 ***************************************************************/
24
25 /**
26 * A column map to map a column configured in $TCA on a property of a domain object.
27 *
28 * @package Extbase
29 * @subpackage Persistence\Mapper
30 * @version $ID:$
31 */
32 // SK: PHPDoc ;-)
33 class Tx_Extbase_Persistence_Mapper_ColumnMap {
34
35 /**
36 * Constants reflecting the type of relation
37 */
38 const RELATION_NONE = 'RELATION_NONE';
39 const RELATION_HAS_ONE = 'RELATION_HAS_ONE';
40 const RELATION_HAS_MANY = 'RELATION_HAS_MANY';
41 const RELATION_BELONGS_TO_MANY = 'RELATION_BELONGS_TO_MANY';
42 const RELATION_HAS_AND_BELONGS_TO_MANY = 'RELATION_HAS_AND_BELONGS_TO_MANY';
43
44 /**
45 * Constants reflecting how the relation information is stored
46 */
47 const RELATION_PARENT_FOREIGN_KEY = 'RELATION_PARENT_FOREIGN_KEY';
48 const RELATION_CHILD_FOREIGN_KEY = 'RELATION_CHILD_FOREIGN_KEY';
49 const RELATION_PARENT_CSV = 'RELATION_PARENT_CSV';
50 const RELATION_INTERMEDIATE_TABLE = 'RELATION_INTERMEDIATE_TABLE';
51
52 /**
53 * Constants reflecting the loading strategy
54 */
55 const STRATEGY_EAGER = 'eager';
56 const STRATEGY_LAZY_PROXY = 'proxy';
57 const STRATEGY_LAZY_STORAGE = 'storage';
58
59 /**
60 * The property name corresponding to the table name
61 *
62 * @var string
63 **/
64 protected $propertyName;
65
66 /**
67 * The column name
68 *
69 * @var string
70 **/
71 protected $columnName;
72
73 /**
74 * The type of relation
75 *
76 * @var int
77 **/
78 protected $typeOfRelation;
79
80 /**
81 * The type of value
82 *
83 * @var int
84 **/
85 protected $propertyType;
86
87 /**
88 * The name of the child's class
89 *
90 * @var string
91 **/
92 protected $childClassName;
93
94 /**
95 * The name of the child's table
96 *
97 * @var string
98 **/
99 protected $childTableName;
100
101 /**
102 * The where clause to narrow down the selected child records
103 *
104 * @var string
105 **/
106 protected $childTableWhereStatement;
107
108 /**
109 * The name of the field the results from the child's table are sorted by
110 *
111 * @var string
112 **/
113 protected $childSortByFieldName;
114
115 /**
116 * The name of the relation table
117 *
118 * @var string
119 **/
120 protected $relationTableName;
121
122 /**
123 * The name of the column of the relation table holding the page id
124 *
125 * @var string
126 **/
127 protected $relationTablePageIdColumnName;
128
129 /**
130 * An array of field => value pairs to both insert and match against when writing/reading MM relations
131 *
132 * @var array
133 **/
134 protected $relationTableMatchFields;
135
136 /**
137 * Array of field=>value pairs to insert when writing new MM relations
138 *
139 * @var array
140 **/
141 protected $relationTableInsertFields;
142
143 /**
144 * The where clause to narrow down the selected relation table records
145 *
146 * @var string
147 **/
148 protected $relationTableWhereStatement;
149
150 /**
151 * The name of the field holding the parents key
152 *
153 * @var string
154 **/
155 protected $parentKeyFieldName;
156
157 /**
158 * The name of the field holding the name of the table of the parent's records
159 *
160 * @var string
161 **/
162 protected $parentTableFieldName;
163
164 /**
165 * The name of the field holding the children key
166 *
167 * @var string
168 **/
169 protected $childKeyFieldName;
170
171 /**
172 * Constructs a Column Map
173 *
174 * @param string $columnName The column name
175 * @param string $propertyName The property name
176 * @return void
177 */
178 public function __construct($columnName, $propertyName) {
179 // TODO Enable aliases (tx_anotherextension_addedcolumn -> theAddedColumn)
180 $this->setColumnName($columnName);
181 $this->setPropertyName($propertyName);
182 }
183
184 public function setTypeOfRelation($typeOfRelation) {
185 $this->typeOfRelation = $typeOfRelation;
186 }
187
188 public function getTypeOfRelation() {
189 return $this->typeOfRelation;
190 }
191
192 public function setPropertyName($propertyName) {
193 $this->propertyName = $propertyName;
194 }
195
196 public function getPropertyName() {
197 return $this->propertyName;
198 }
199
200 public function setColumnName($columnName) {
201 $this->columnName = $columnName;
202 }
203
204 public function getColumnName() {
205 return $this->columnName;
206 }
207
208 public function setChildTableName($childTableName) {
209 $this->childTableName = $childTableName;
210 }
211
212 public function getChildTableName() {
213 return $this->childTableName;
214 }
215
216 public function setChildTableWhereStatement($childTableWhereStatement) {
217 $this->childTableWhereStatement = $childTableWhereStatement;
218 }
219
220 public function getChildTableWhereStatement() {
221 return $this->childTableWhereStatement;
222 }
223
224 public function setChildSortByFieldName($childSortByFieldName) {
225 $this->childSortByFieldName = $childSortByFieldName;
226 }
227
228 public function getChildSortByFieldName() {
229 return $this->childSortByFieldName;
230 }
231
232 public function setRelationTableName($relationTableName) {
233 $this->relationTableName = $relationTableName;
234 }
235
236 public function getRelationTableName() {
237 return $this->relationTableName;
238 }
239
240 public function setRelationTablePageIdColumnName($relationTablePageIdColumnName) {
241 $this->relationTablePageIdColumnName = $relationTablePageIdColumnName;
242 }
243
244 public function getRelationTablePageIdColumnName() {
245 return $this->relationTablePageIdColumnName;
246 }
247
248 public function setRelationTableMatchFields(array $relationTableMatchFields) {
249 $this->relationTableMatchFields = $relationTableMatchFields;
250 }
251
252 public function getRelationTableMatchFields() {
253 return $this->relationTableMatchFields;
254 }
255
256 public function setRelationTableInsertFields(array $relationTableInsertFields) {
257 $this->relationTableInsertFields = $relationTableInsertFields;
258 }
259
260 public function getRelationTableInsertFields() {
261 return $this->relationTableInsertFields;
262 }
263
264 public function setRelationTableWhereStatement($relationTableWhereStatement) {
265 $this->relationTableWhereStatement = $relationTableWhereStatement;
266 }
267
268 public function getRelationTableWhereStatement() {
269 return $this->relationTableWhereStatement;
270 }
271
272 public function setParentKeyFieldName($parentKeyFieldName) {
273 $this->parentKeyFieldName = $parentKeyFieldName;
274 }
275
276 public function getParentKeyFieldName() {
277 return $this->parentKeyFieldName;
278 }
279
280 public function setParentTableFieldName($parentTableFieldName) {
281 $this->parentTableFieldName = $parentTableFieldName;
282 }
283
284 public function getParentTableFieldName() {
285 return $this->parentTableFieldName;
286 }
287
288 public function setChildKeyFieldName($childKeyFieldName) {
289 $this->childKeyFieldName = $childKeyFieldName;
290 }
291
292 public function getChildKeyFieldName() {
293 return $this->childKeyFieldName;
294 }
295
296 }
297 ?>