‪TYPO3CMS  10.4
PropertyType.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
38 {
46  const ‪UNDEFINED = 0;
47 
51  const ‪STRING = 1;
52 
56  const ‪BINARY = 2;
57 
61  const ‪LONG = 3;
62 
66  const ‪DOUBLE = 4;
67 
71  const ‪DATE = 5;
72 
76  const ‪BOOLEAN = 6;
77 
84  const ‪NAME = 7;
85 
93  const ‪PATH = 8;
94 
102  const ‪REFERENCE = 9;
103 
111  const ‪WEAKREFERENCE = 10;
112 
120  const ‪URI = 11;
121 
127  const ‪DECIMAL = 12;
128 
134  const ‪INTEGER = 13;
135 
139  const ‪TYPENAME_UNDEFINED = 'undefined';
140 
144  const ‪TYPENAME_STRING = 'String';
145 
149  const ‪TYPENAME_BINARY = 'Binary';
150 
154  const ‪TYPENAME_LONG = 'Long';
155 
159  const ‪TYPENAME_DOUBLE = 'Double';
160 
164  const ‪TYPENAME_DATE = 'Date';
165 
169  const ‪TYPENAME_BOOLEAN = 'Boolean';
170 
174  const ‪TYPENAME_NAME = 'Name';
175 
179  const ‪TYPENAME_PATH = 'Path';
180 
184  const ‪TYPENAME_REFERENCE = 'Reference';
185 
189  const ‪TYPENAME_WEAKREFERENCE = 'WeakReference';
190 
194  const ‪TYPENAME_URI = 'URI';
195 
199  const ‪TYPENAME_DECIMAL = 'Decimal';
200 
204  const ‪TYPENAME_INTEGER = 'Integer';
205 
209  private function ‪__construct()
210  {
211  }
212 
219  public static function ‪nameFromValue($type)
220  {
221  switch ((int)$type) {
222  case ‪self::STRING:
223  $name = ‪self::TYPENAME_STRING;
224  break;
225  case ‪self::BINARY:
226  $name = ‪self::TYPENAME_BINARY;
227  break;
228  case ‪self::BOOLEAN:
230  break;
231  case ‪self::LONG:
232  $name = ‪self::TYPENAME_LONG;
233  break;
234  case ‪self::DOUBLE:
235  $name = ‪self::TYPENAME_DOUBLE;
236  break;
237  case ‪self::DECIMAL:
239  break;
240  case ‪self::INTEGER:
242  break;
243  case ‪self::DATE:
244  $name = ‪self::TYPENAME_DATE;
245  break;
246  case ‪self::NAME:
247  $name = ‪self::TYPENAME_NAME;
248  break;
249  case ‪self::PATH:
250  $name = ‪self::TYPENAME_PATH;
251  break;
252  case ‪self::REFERENCE:
254  break;
257  break;
258  case ‪self::URI:
259  $name = ‪self::TYPENAME_URI;
260  break;
261  default:
262  // case self::UNDEFINED:
264  }
265 
266  return $name;
267  }
268 
275  public static function ‪valueFromName($name)
276  {
277  switch ($name) {
279  $value = ‪self::STRING;
280  break;
282  $value = ‪self::BINARY;
283  break;
285  $value = ‪self::LONG;
286  break;
288  $value = ‪self::DOUBLE;
289  break;
291  $value = ‪self::DECIMAL;
292  break;
294  $value = ‪self::INTEGER;
295  break;
297  $value = ‪self::DATE;
298  break;
300  $value = ‪self::BOOLEAN;
301  break;
303  $value = ‪self::NAME;
304  break;
306  $value = ‪self::PATH;
307  break;
309  $value = ‪self::REFERENCE;
310  break;
312  $value = ‪self::WEAKREFERENCE;
313  break;
315  $value = ‪self::URI;
316  break;
317  default:
318  // case self::TYPENAME_UNDEFINED:
319  $value = ‪self::UNDEFINED;
320  }
321 
322  return $value;
323  }
324 
332  public static function ‪valueFromType($type)
333  {
334  switch (strtolower($type)) {
335  case 'string':
337  break;
338  case 'boolean':
340  break;
341  case 'integer':
343  break;
344  case 'float':
345 
346  case 'double':
348  break;
349  case 'int':
351  break;
352  case 'datetime':
354  break;
355  default:
357  }
358 
359  return $value;
360  }
361 }
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\TYPENAME_PATH
‪const TYPENAME_PATH
Definition: PropertyType.php:179
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\TYPENAME_BOOLEAN
‪const TYPENAME_BOOLEAN
Definition: PropertyType.php:169
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType
Definition: PropertyType.php:38
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\valueFromName
‪static int valueFromName($name)
Definition: PropertyType.php:275
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\TYPENAME_STRING
‪const TYPENAME_STRING
Definition: PropertyType.php:144
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\UNDEFINED
‪const UNDEFINED
Definition: PropertyType.php:46
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\LONG
‪const LONG
Definition: PropertyType.php:61
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\TYPENAME_INTEGER
‪const TYPENAME_INTEGER
Definition: PropertyType.php:204
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\TYPENAME_REFERENCE
‪const TYPENAME_REFERENCE
Definition: PropertyType.php:184
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\TYPENAME_LONG
‪const TYPENAME_LONG
Definition: PropertyType.php:154
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\TYPENAME_NAME
‪const TYPENAME_NAME
Definition: PropertyType.php:174
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\TYPENAME_WEAKREFERENCE
‪const TYPENAME_WEAKREFERENCE
Definition: PropertyType.php:189
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\TYPENAME_DECIMAL
‪const TYPENAME_DECIMAL
Definition: PropertyType.php:199
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\TYPENAME_DATE
‪const TYPENAME_DATE
Definition: PropertyType.php:164
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\DECIMAL
‪const DECIMAL
Definition: PropertyType.php:127
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\STRING
‪const STRING
Definition: PropertyType.php:51
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\__construct
‪__construct()
Definition: PropertyType.php:209
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\TYPENAME_URI
‪const TYPENAME_URI
Definition: PropertyType.php:194
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\DATE
‪const DATE
Definition: PropertyType.php:71
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\BINARY
‪const BINARY
Definition: PropertyType.php:56
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\PATH
‪const PATH
Definition: PropertyType.php:93
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\TYPENAME_UNDEFINED
‪const TYPENAME_UNDEFINED
Definition: PropertyType.php:139
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\nameFromValue
‪static string nameFromValue($type)
Definition: PropertyType.php:219
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\WEAKREFERENCE
‪const WEAKREFERENCE
Definition: PropertyType.php:111
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\valueFromType
‪static int valueFromType($type)
Definition: PropertyType.php:332
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\TYPENAME_BINARY
‪const TYPENAME_BINARY
Definition: PropertyType.php:149
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\TYPENAME_DOUBLE
‪const TYPENAME_DOUBLE
Definition: PropertyType.php:159
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\URI
‪const URI
Definition: PropertyType.php:120
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\REFERENCE
‪const REFERENCE
Definition: PropertyType.php:102
‪TYPO3\CMS\Extbase\Persistence\Generic
Definition: Backend.php:16
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\NAME
‪const NAME
Definition: PropertyType.php:84
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\BOOLEAN
‪const BOOLEAN
Definition: PropertyType.php:76
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\INTEGER
‪const INTEGER
Definition: PropertyType.php:134
‪TYPO3\CMS\Extbase\Persistence\Generic\PropertyType\DOUBLE
‪const DOUBLE
Definition: PropertyType.php:66