‪TYPO3CMS  9.5
PropertyType.php
Go to the documentation of this file.
1 <?php
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 
37 {
45  const ‪UNDEFINED = 0;
46 
50  const ‪STRING = 1;
51 
55  const ‪BINARY = 2;
56 
60  const ‪LONG = 3;
61 
65  const ‪DOUBLE = 4;
66 
70  const ‪DATE = 5;
71 
75  const ‪BOOLEAN = 6;
76 
83  const ‪NAME = 7;
84 
92  const ‪PATH = 8;
93 
101  const ‪REFERENCE = 9;
102 
110  const ‪WEAKREFERENCE = 10;
111 
119  const ‪URI = 11;
120 
126  const ‪DECIMAL = 12;
127 
133  const ‪INTEGER = 13;
134 
138  const ‪TYPENAME_UNDEFINED = 'undefined';
139 
143  const ‪TYPENAME_STRING = 'String';
144 
148  const ‪TYPENAME_BINARY = 'Binary';
149 
153  const ‪TYPENAME_LONG = 'Long';
154 
158  const ‪TYPENAME_DOUBLE = 'Double';
159 
163  const ‪TYPENAME_DATE = 'Date';
164 
168  const ‪TYPENAME_BOOLEAN = 'Boolean';
169 
173  const ‪TYPENAME_NAME = 'Name';
174 
178  const ‪TYPENAME_PATH = 'Path';
179 
183  const ‪TYPENAME_REFERENCE = 'Reference';
184 
188  const ‪TYPENAME_WEAKREFERENCE = 'WeakReference';
189 
193  const ‪TYPENAME_URI = 'URI';
194 
198  const ‪TYPENAME_DECIMAL = 'Decimal';
199 
203  const ‪TYPENAME_INTEGER = 'Integer';
204 
208  private function ‪__construct()
209  {
210  }
211 
218  public static function ‪nameFromValue($type)
219  {
220  switch ((int)$type) {
221  case ‪self::STRING:
222  $name = ‪self::TYPENAME_STRING;
223  break;
224  case ‪self::BINARY:
225  $name = ‪self::TYPENAME_BINARY;
226  break;
227  case ‪self::BOOLEAN:
229  break;
230  case ‪self::LONG:
231  $name = ‪self::TYPENAME_LONG;
232  break;
233  case ‪self::DOUBLE:
234  $name = ‪self::TYPENAME_DOUBLE;
235  break;
236  case ‪self::DECIMAL:
238  break;
239  case ‪self::INTEGER:
241  break;
242  case ‪self::DATE:
243  $name = ‪self::TYPENAME_DATE;
244  break;
245  case ‪self::NAME:
246  $name = ‪self::TYPENAME_NAME;
247  break;
248  case ‪self::PATH:
249  $name = ‪self::TYPENAME_PATH;
250  break;
251  case ‪self::REFERENCE:
253  break;
256  break;
257  case ‪self::URI:
258  $name = ‪self::TYPENAME_URI;
259  break;
260  default:
261  // case self::UNDEFINED:
263  }
264 
265  return $name;
266  }
267 
274  public static function ‪valueFromName($name)
275  {
276  switch ($name) {
278  $value = ‪self::STRING;
279  break;
281  $value = ‪self::BINARY;
282  break;
284  $value = ‪self::LONG;
285  break;
287  $value = ‪self::DOUBLE;
288  break;
290  $value = ‪self::DECIMAL;
291  break;
293  $value = ‪self::INTEGER;
294  break;
296  $value = ‪self::DATE;
297  break;
299  $value = ‪self::BOOLEAN;
300  break;
302  $value = ‪self::NAME;
303  break;
305  $value = ‪self::PATH;
306  break;
308  $value = ‪self::REFERENCE;
309  break;
311  $value = ‪self::WEAKREFERENCE;
312  break;
314  $value = ‪self::URI;
315  break;
316  default:
317  // case self::TYPENAME_UNDEFINED:
318  $value = ‪self::UNDEFINED;
319  }
320 
321  return $value;
322  }
323 
331  public static function ‪valueFromType($type)
332  {
333  switch (strtolower($type)) {
334  case 'string':
336  break;
337  case 'boolean':
339  break;
340  case 'integer':
342  break;
343  case 'float':
344 
345  case 'double':
347  break;
348  case 'int':
350  break;
351  case 'datetime':
353  break;
354  default:
356  }
357 
358  return $value;
359  }
360 }
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\TYPENAME_PATH
‪const TYPENAME_PATH
Definition: PropertyType.php:178
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\TYPENAME_BOOLEAN
‪const TYPENAME_BOOLEAN
Definition: PropertyType.php:168
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType
Definition: PropertyType.php:37
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\valueFromName
‪static int valueFromName($name)
Definition: PropertyType.php:274
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\TYPENAME_STRING
‪const TYPENAME_STRING
Definition: PropertyType.php:143
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\UNDEFINED
‪const UNDEFINED
Definition: PropertyType.php:45
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\LONG
‪const LONG
Definition: PropertyType.php:60
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\TYPENAME_INTEGER
‪const TYPENAME_INTEGER
Definition: PropertyType.php:203
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\TYPENAME_REFERENCE
‪const TYPENAME_REFERENCE
Definition: PropertyType.php:183
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\TYPENAME_LONG
‪const TYPENAME_LONG
Definition: PropertyType.php:153
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\TYPENAME_NAME
‪const TYPENAME_NAME
Definition: PropertyType.php:173
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\TYPENAME_WEAKREFERENCE
‪const TYPENAME_WEAKREFERENCE
Definition: PropertyType.php:188
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\TYPENAME_DECIMAL
‪const TYPENAME_DECIMAL
Definition: PropertyType.php:198
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\TYPENAME_DATE
‪const TYPENAME_DATE
Definition: PropertyType.php:163
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\DECIMAL
‪const DECIMAL
Definition: PropertyType.php:126
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\STRING
‪const STRING
Definition: PropertyType.php:50
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\__construct
‪__construct()
Definition: PropertyType.php:208
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\TYPENAME_URI
‪const TYPENAME_URI
Definition: PropertyType.php:193
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\DATE
‪const DATE
Definition: PropertyType.php:70
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\BINARY
‪const BINARY
Definition: PropertyType.php:55
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\PATH
‪const PATH
Definition: PropertyType.php:92
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\TYPENAME_UNDEFINED
‪const TYPENAME_UNDEFINED
Definition: PropertyType.php:138
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\nameFromValue
‪static string nameFromValue($type)
Definition: PropertyType.php:218
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\WEAKREFERENCE
‪const WEAKREFERENCE
Definition: PropertyType.php:110
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\valueFromType
‪static int valueFromType($type)
Definition: PropertyType.php:331
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\TYPENAME_BINARY
‪const TYPENAME_BINARY
Definition: PropertyType.php:148
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\TYPENAME_DOUBLE
‪const TYPENAME_DOUBLE
Definition: PropertyType.php:158
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\URI
‪const URI
Definition: PropertyType.php:119
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\REFERENCE
‪const REFERENCE
Definition: PropertyType.php:101
‪TYPO3\CMS\Extbase\Persistence\Generic
Definition: Backend.php:2
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\NAME
‪const NAME
Definition: PropertyType.php:83
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\BOOLEAN
‪const BOOLEAN
Definition: PropertyType.php:75
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\INTEGER
‪const INTEGER
Definition: PropertyType.php:133
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\DOUBLE
‪const DOUBLE
Definition: PropertyType.php:65