l11n, unit/app and simplification fixes

This commit is contained in:
Dennis Eichhorn 2023-01-07 19:00:33 +01:00
parent c140c89935
commit 94f065a383
4 changed files with 22 additions and 4 deletions

View File

@ -13,6 +13,14 @@
"name": "support_app_name",
"type": "VARCHAR(255)",
"default": null
},
"support_app_unit": {
"name": "support_app_unit",
"type": "INT",
"default": null,
"null": true,
"foreignTable": "organization_unit",
"foreignKey": "organization_unit_id"
}
}
},

View File

@ -374,6 +374,7 @@ final class ApiController extends Controller
{
$app = new SupportApp();
$app->name = (string) ($request->getData('name') ?? '');
$app->unit = $request->getData('unit', 'int');
return $app;
}
@ -662,13 +663,13 @@ final class ApiController extends Controller
$type = (int) ($request->getData('type') ?? 0);
if ($type === AttributeValueType::_INT) {
$attrValue->valueInt = $request->hasData('value') ? (int) $request->getData('value') : null;
$attrValue->valueInt = $request->getData('value', 'int');
} elseif ($type === AttributeValueType::_STRING) {
$attrValue->valueStr = $request->hasData('value') ? (string) $request->getData('value') : null;
$attrValue->valueStr = $request->getData('value', 'string');
} elseif ($type === AttributeValueType::_FLOAT) {
$attrValue->valueDec = $request->hasData('value') ? (float) $request->getData('value') : null;
$attrValue->valueDec = $request->getData('value', 'float');
} elseif ($type === AttributeValueType::_DATETIME) {
$attrValue->valueDat = $request->hasData('value') ? new \DateTime((string) ($request->getData('value') ?? '')) : null;
$attrValue->valueDat = $request->getData('value', 'DateTime');
}
$attrValue->type = $type;

View File

@ -40,6 +40,14 @@ class SupportApp implements \JsonSerializable
*/
public string $name = '';
/**
* Unit
*
* @var null|int
* @since 1.0.0
*/
public ?int $unit = null;
/**
* Get id.
*

View File

@ -35,6 +35,7 @@ final class SupportAppMapper extends DataMapperFactory
public const COLUMNS = [
'support_app_id' => ['name' => 'support_app_id', 'type' => 'int', 'internal' => 'id'],
'support_app_name' => ['name' => 'support_app_name', 'type' => 'string', 'internal' => 'name'],
'support_app_unit' => ['name' => 'support_app_unit', 'type' => 'int', 'internal' => 'unit'],
];
/**