3 declare(strict_types=1);
33 private static $discriminatorClasses = [
34 'Boolean' => BooleanFieldModel::class,
35 'BooleanSet' => BooleanSetFieldModel::class,
36 'Date' => DateFieldModel::class,
37 'DateSet' => DateSetFieldModel::class,
38 'DateTime' => DateTimeFieldModel::class,
39 'DateTimeSet' => DateTimeSetFieldModel::class,
40 'Enum' => EnumFieldModel::class,
41 'EnumSet' => EnumSetFieldModel::class,
42 'LocalizedEnum' => LocalizedEnumFieldModel::class,
43 'LocalizedEnumSet' => LocalizedEnumSetFieldModel::class,
44 'LocalizedString' => LocalizedStringFieldModel::class,
45 'LocalizedStringSet' => LocalizedStringSetFieldModel::class,
46 'Money' => MoneyFieldModel::class,
47 'MoneySet' => MoneySetFieldModel::class,
48 'Number' => NumberFieldModel::class,
49 'NumberSet' => NumberSetFieldModel::class,
50 'Reference' => ReferenceFieldModel::class,
51 'ReferenceSet' => ReferenceSetFieldModel::class,
52 'String' => StringFieldModel::class,
53 'StringSet' => StringSetFieldModel::class,
54 'Time' => TimeFieldModel::class,
55 'TimeSet' => TimeSetFieldModel::class,
75 if (is_null($this->type)) {
77 $data = $this->
raw(self::FIELD_TYPE);
81 $this->type = (string) $data;
98 if (is_object($value) && isset($value->$fieldName)) {
100 $discriminatorValue = $value->$fieldName;
101 if (isset(self::$discriminatorClasses[$discriminatorValue])) {
102 return self::$discriminatorClasses[$discriminatorValue];
105 if (is_array($value) && isset($value[$fieldName])) {
107 $discriminatorValue = $value[$fieldName];
108 if (isset(self::$discriminatorClasses[$discriminatorValue])) {
109 return self::$discriminatorClasses[$discriminatorValue];
114 $type = CustomFieldModel::class;