From 67ecfeffcadbc2e88083cbb33846f5db39be3974 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 19 Dec 2021 20:20:39 +0100 Subject: [PATCH] bug fixes / dbmapper fixes --- Controller/BackendController.php | 3 +- Models/KanbanBoardMapper.php | 30 +++++++++--------- Models/KanbanCardCommentMapper.php | 16 +++++----- Models/KanbanCardMapper.php | 38 +++++++++++------------ Models/KanbanColumnMapper.php | 8 ++--- Theme/Backend/kanban-board-create.tpl.php | 14 ++++++++- 6 files changed, 60 insertions(+), 49 deletions(-) diff --git a/Controller/BackendController.php b/Controller/BackendController.php index 2df893f..57c9501 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -18,7 +18,6 @@ use Modules\Kanban\Models\KanbanBoardMapper; use Modules\Kanban\Models\KanbanCardMapper; use Modules\Kanban\Models\PermissionState; use phpOMS\Account\PermissionType; -use phpOMS\Algorithm\Sort\SortOrder; use phpOMS\Asset\AssetType; use phpOMS\Contract\RenderableInterface; use phpOMS\DataStorage\Database\Query\OrderType; @@ -105,7 +104,7 @@ final class BackendController extends Controller { $view = new View($this->app->l11nManager, $request, $response); - $board = KanbanBoardMapper::get() + $board = KanbanBoardMapper::get() ->with('columns') ->with('columns/cards') ->with('columns/cards/tags') diff --git a/Models/KanbanBoardMapper.php b/Models/KanbanBoardMapper.php index ee5234a..6b57643 100755 --- a/Models/KanbanBoardMapper.php +++ b/Models/KanbanBoardMapper.php @@ -35,15 +35,15 @@ final class KanbanBoardMapper extends DataMapperFactory * @since 1.0.0 */ public const COLUMNS = [ - 'kanban_board_id' => ['name' => 'kanban_board_id', 'type' => 'int', 'internal' => 'id'], - 'kanban_board_name' => ['name' => 'kanban_board_name', 'type' => 'string', 'internal' => 'name'], - 'kanban_board_desc' => ['name' => 'kanban_board_desc', 'type' => 'string', 'internal' => 'description'], - 'kanban_board_descraw' => ['name' => 'kanban_board_descraw', 'type' => 'string', 'internal' => 'descriptionRaw'], - 'kanban_board_status' => ['name' => 'kanban_board_status', 'type' => 'int', 'internal' => 'status'], - 'kanban_board_order' => ['name' => 'kanban_board_order', 'type' => 'int', 'internal' => 'order'], - 'kanban_board_style' => ['name' => 'kanban_board_style', 'type' => 'string', 'internal' => 'style'], - 'kanban_board_created_by' => ['name' => 'kanban_board_created_by', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true], - 'kanban_board_created_at' => ['name' => 'kanban_board_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true], + 'kanban_board_id' => ['name' => 'kanban_board_id', 'type' => 'int', 'internal' => 'id'], + 'kanban_board_name' => ['name' => 'kanban_board_name', 'type' => 'string', 'internal' => 'name'], + 'kanban_board_desc' => ['name' => 'kanban_board_desc', 'type' => 'string', 'internal' => 'description'], + 'kanban_board_descraw' => ['name' => 'kanban_board_descraw', 'type' => 'string', 'internal' => 'descriptionRaw'], + 'kanban_board_status' => ['name' => 'kanban_board_status', 'type' => 'int', 'internal' => 'status'], + 'kanban_board_order' => ['name' => 'kanban_board_order', 'type' => 'int', 'internal' => 'order'], + 'kanban_board_style' => ['name' => 'kanban_board_style', 'type' => 'string', 'internal' => 'style'], + 'kanban_board_created_by' => ['name' => 'kanban_board_created_by', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true], + 'kanban_board_created_at' => ['name' => 'kanban_board_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true], ]; /** @@ -54,10 +54,10 @@ final class KanbanBoardMapper extends DataMapperFactory */ public const HAS_MANY = [ 'columns' => [ - 'mapper' => KanbanColumnMapper::class, - 'table' => 'kanban_column', - 'self' => 'kanban_column_board', - 'external' => null, + 'mapper' => KanbanColumnMapper::class, + 'table' => 'kanban_column', + 'self' => 'kanban_column_board', + 'external' => null, ], 'tags' => [ 'mapper' => TagMapper::class, @@ -75,8 +75,8 @@ final class KanbanBoardMapper extends DataMapperFactory */ public const BELONGS_TO = [ 'createdBy' => [ - 'mapper' => AccountMapper::class, - 'external' => 'kanban_board_created_by', + 'mapper' => AccountMapper::class, + 'external' => 'kanban_board_created_by', ], ]; diff --git a/Models/KanbanCardCommentMapper.php b/Models/KanbanCardCommentMapper.php index 89935b0..92ae150 100755 --- a/Models/KanbanCardCommentMapper.php +++ b/Models/KanbanCardCommentMapper.php @@ -35,12 +35,12 @@ final class KanbanCardCommentMapper extends DataMapperFactory * @since 1.0.0 */ public const COLUMNS = [ - 'kanban_card_comment_id' => ['name' => 'kanban_card_comment_id', 'type' => 'int', 'internal' => 'id'], - 'kanban_card_comment_description' => ['name' => 'kanban_card_comment_description', 'type' => 'string', 'internal' => 'description'], - 'kanban_card_comment_descriptionraw' => ['name' => 'kanban_card_comment_descriptionraw', 'type' => 'string', 'internal' => 'descriptionRaw'], - 'kanban_card_comment_card' => ['name' => 'kanban_card_comment_card', 'type' => 'int', 'internal' => 'card'], - 'kanban_card_comment_created_at' => ['name' => 'kanban_card_comment_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true], - 'kanban_card_comment_created_by' => ['name' => 'kanban_card_comment_created_by', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true], + 'kanban_card_comment_id' => ['name' => 'kanban_card_comment_id', 'type' => 'int', 'internal' => 'id'], + 'kanban_card_comment_description' => ['name' => 'kanban_card_comment_description', 'type' => 'string', 'internal' => 'description'], + 'kanban_card_comment_descriptionraw' => ['name' => 'kanban_card_comment_descriptionraw', 'type' => 'string', 'internal' => 'descriptionRaw'], + 'kanban_card_comment_card' => ['name' => 'kanban_card_comment_card', 'type' => 'int', 'internal' => 'card'], + 'kanban_card_comment_created_at' => ['name' => 'kanban_card_comment_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true], + 'kanban_card_comment_created_by' => ['name' => 'kanban_card_comment_created_by', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true], ]; /** @@ -66,8 +66,8 @@ final class KanbanCardCommentMapper extends DataMapperFactory */ public const BELONGS_TO = [ 'createdBy' => [ - 'mapper' => AccountMapper::class, - 'external' => 'kanban_card_comment_created_by', + 'mapper' => AccountMapper::class, + 'external' => 'kanban_card_comment_created_by', ], ]; diff --git a/Models/KanbanCardMapper.php b/Models/KanbanCardMapper.php index 6ae870e..f3e60b8 100755 --- a/Models/KanbanCardMapper.php +++ b/Models/KanbanCardMapper.php @@ -36,19 +36,19 @@ final class KanbanCardMapper extends DataMapperFactory * @since 1.0.0 */ public const COLUMNS = [ - 'kanban_card_id' => ['name' => 'kanban_card_id', 'type' => 'int', 'internal' => 'id'], - 'kanban_card_name' => ['name' => 'kanban_card_name', 'type' => 'string', 'internal' => 'name'], - 'kanban_card_description' => ['name' => 'kanban_card_description', 'type' => 'string', 'internal' => 'description'], - 'kanban_card_descriptionraw' => ['name' => 'kanban_card_descriptionraw', 'type' => 'string', 'internal' => 'descriptionRaw'], - 'kanban_card_style' => ['name' => 'kanban_card_style', 'type' => 'string', 'internal' => 'style'], - 'kanban_card_type' => ['name' => 'kanban_card_type', 'type' => 'int', 'internal' => 'type'], - 'kanban_card_status' => ['name' => 'kanban_card_status', 'type' => 'int', 'internal' => 'status'], - 'kanban_card_order' => ['name' => 'kanban_card_order', 'type' => 'int', 'internal' => 'order'], - 'kanban_card_color' => ['name' => 'kanban_card_color', 'type' => 'string', 'internal' => 'color'], - 'kanban_card_ref' => ['name' => 'kanban_card_ref', 'type' => 'int', 'internal' => 'ref'], - 'kanban_card_column' => ['name' => 'kanban_card_column', 'type' => 'int', 'internal' => 'column'], - 'kanban_card_created_at' => ['name' => 'kanban_card_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true], - 'kanban_card_created_by' => ['name' => 'kanban_card_created_by', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true], + 'kanban_card_id' => ['name' => 'kanban_card_id', 'type' => 'int', 'internal' => 'id'], + 'kanban_card_name' => ['name' => 'kanban_card_name', 'type' => 'string', 'internal' => 'name'], + 'kanban_card_description' => ['name' => 'kanban_card_description', 'type' => 'string', 'internal' => 'description'], + 'kanban_card_descriptionraw' => ['name' => 'kanban_card_descriptionraw', 'type' => 'string', 'internal' => 'descriptionRaw'], + 'kanban_card_style' => ['name' => 'kanban_card_style', 'type' => 'string', 'internal' => 'style'], + 'kanban_card_type' => ['name' => 'kanban_card_type', 'type' => 'int', 'internal' => 'type'], + 'kanban_card_status' => ['name' => 'kanban_card_status', 'type' => 'int', 'internal' => 'status'], + 'kanban_card_order' => ['name' => 'kanban_card_order', 'type' => 'int', 'internal' => 'order'], + 'kanban_card_color' => ['name' => 'kanban_card_color', 'type' => 'string', 'internal' => 'color'], + 'kanban_card_ref' => ['name' => 'kanban_card_ref', 'type' => 'int', 'internal' => 'ref'], + 'kanban_card_column' => ['name' => 'kanban_card_column', 'type' => 'int', 'internal' => 'column'], + 'kanban_card_created_at' => ['name' => 'kanban_card_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true], + 'kanban_card_created_by' => ['name' => 'kanban_card_created_by', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true], ]; /** @@ -59,8 +59,8 @@ final class KanbanCardMapper extends DataMapperFactory */ public const BELONGS_TO = [ 'createdBy' => [ - 'mapper' => AccountMapper::class, - 'external' => 'kanban_card_created_by', + 'mapper' => AccountMapper::class, + 'external' => 'kanban_card_created_by', ], ]; @@ -78,10 +78,10 @@ final class KanbanCardMapper extends DataMapperFactory 'self' => 'kanban_card_media_src', ], 'comments' => [ - 'mapper' => KanbanCardCommentMapper::class, - 'table' => 'kanban_card_comment', - 'self' => 'kanban_card_comment_card', - 'external' => null, + 'mapper' => KanbanCardCommentMapper::class, + 'table' => 'kanban_card_comment', + 'self' => 'kanban_card_comment_card', + 'external' => null, ], 'tags' => [ 'mapper' => TagMapper::class, diff --git a/Models/KanbanColumnMapper.php b/Models/KanbanColumnMapper.php index 2a61a77..433df72 100755 --- a/Models/KanbanColumnMapper.php +++ b/Models/KanbanColumnMapper.php @@ -47,10 +47,10 @@ final class KanbanColumnMapper extends DataMapperFactory */ public const HAS_MANY = [ 'cards' => [ - 'mapper' => KanbanCardMapper::class, - 'table' => 'kanban_card', - 'self' => 'kanban_card_column', - 'external' => null, + 'mapper' => KanbanCardMapper::class, + 'table' => 'kanban_card', + 'self' => 'kanban_card_column', + 'external' => null, ], ]; diff --git a/Theme/Backend/kanban-board-create.tpl.php b/Theme/Backend/kanban-board-create.tpl.php index 82e9c95..7a9ace7 100755 --- a/Theme/Backend/kanban-board-create.tpl.php +++ b/Theme/Backend/kanban-board-create.tpl.php @@ -1,2 +1,14 @@ -getData('nav')->render();