l11n, unit/app and simplification fixes

This commit is contained in:
Dennis Eichhorn 2023-01-07 19:00:32 +01:00
parent 98fb4bcc48
commit 8bbfdb8baf
4 changed files with 39 additions and 1 deletions

View File

@ -43,7 +43,9 @@
"news_lang": {
"name": "news_lang",
"type": "VARCHAR(2)",
"null": false
"null": false,
"foreignTable": "language",
"foreignKey": "language_639_1"
},
"news_publish": {
"name": "news_publish",
@ -56,6 +58,22 @@
"null": true,
"default": null
},
"news_unit": {
"name": "news_unit",
"type": "INT",
"default": null,
"null": true,
"foreignTable": "organization_unit",
"foreignKey": "organization_unit_id"
},
"news_app": {
"name": "news_app",
"type": "INT",
"default": null,
"null": true,
"foreignTable": "app",
"foreignKey": "app_id"
},
"news_created_at": {
"name": "news_created_at",
"type": "DATETIME",

View File

@ -124,6 +124,8 @@ final class ApiController extends Controller
$newsArticle->setType((int) ($request->getData('type') ?? $newsArticle->getType()));
$newsArticle->setStatus((int) ($request->getData('status') ?? $newsArticle->getStatus()));
$newsArticle->isFeatured = (bool) ($request->getData('featured') ?? $newsArticle->isFeatured);
$newsArticle->unit = $request->getData('unit', 'int');
$newsArticle->app = $request->getData('app', 'int');
return $newsArticle;
}

View File

@ -89,6 +89,22 @@ class NewsArticle implements \JsonSerializable
*/
private string $language = ISO639x1Enum::_EN;
/**
* Unit
*
* @var null|int
* @since 1.0.0
*/
public ?int $unit = null;
/**
* Application
*
* @var null|int
* @since 1.0.0
*/
public ?int $app = null;
/**
* Created.
*

View File

@ -47,6 +47,8 @@ final class NewsArticleMapper extends DataMapperFactory
'news_type' => ['name' => 'news_type', 'type' => 'int', 'internal' => 'type'],
'news_featured' => ['name' => 'news_featured', 'type' => 'bool', 'internal' => 'isFeatured'],
'news_comment_list' => ['name' => 'news_comment_list', 'type' => 'int', 'internal' => 'comments'],
'news_unit' => ['name' => 'news_unit', 'type' => 'int', 'internal' => 'unit'],
'news_app' => ['name' => 'news_app', 'type' => 'int', 'internal' => 'app'],
'news_created_at' => ['name' => 'news_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true],
'news_created_by' => ['name' => 'news_created_by', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true],
];