ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilDclDefaultValueFactory.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22{
23 public const STORAGE_LOCATION_MAPPING = [
24 1 => ilDclTableViewTextDefaultValue::class,
25 2 => ilDclTableViewNumberDefaultValue::class,
26 3 => ilDclTableViewDateDefaultValue::class
27 ];
28
29 public function create(int $data_type_id): ilDclTableViewBaseDefaultValue
30 {
31 $storage_location = ilDclCache::getDatatype($data_type_id)->getStorageLocation();
32 $class = self::STORAGE_LOCATION_MAPPING[$storage_location];
33 return new $class();
34 }
35
36 public function createByTableName(string $table_name): ilDclTableViewBaseDefaultValue
37 {
38 switch ($table_name) {
44 default:
46 }
47 }
48}
static getDatatype(int $datatyp_id)
Get cached datatypes.