From bc96f822fc81d1d0d32fbabe99ab91673e4ffd8e Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Wed, 3 Apr 2024 18:53:54 +0200 Subject: [PATCH] fix(Contexts): explicitely state non-int types Signed-off-by: Arthur Schiwon --- lib/Db/Context.php | 1 + lib/Db/ContextMapper.php | 20 ++++++++++---------- lib/Db/ContextNodeRelation.php | 4 ++++ lib/Db/PageContent.php | 3 +++ 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/lib/Db/Context.php b/lib/Db/Context.php index 8da45c6b3..141fd9009 100644 --- a/lib/Db/Context.php +++ b/lib/Db/Context.php @@ -38,6 +38,7 @@ class Context extends Entity implements JsonSerializable { public function __construct() { $this->addType('id', 'integer'); + $this->addType('owner_type', 'integer'); } public function jsonSerialize(): array { diff --git a/lib/Db/ContextMapper.php b/lib/Db/ContextMapper.php index 91b6ae44a..849ffa35a 100644 --- a/lib/Db/ContextMapper.php +++ b/lib/Db/ContextMapper.php @@ -83,13 +83,13 @@ protected function formatResultRows(array $rows, ?string $userId) { return $carry; } $carry[$item['share_id']] = [ - 'share_id' => $item['share_id'], + 'share_id' => (int)$item['share_id'], 'receiver' => $item['receiver'], 'receiver_type' => $item['receiver_type'], - 'display_mode_default' => $item['display_mode_default'], + 'display_mode_default' => (int)$item['display_mode_default'], ]; if ($userId !== null) { - $carry[$item['share_id']]['display_mode'] = $item['display_mode']; + $carry[$item['share_id']]['display_mode'] = (int)$item['display_mode']; } return $carry; }, []); @@ -100,10 +100,10 @@ protected function formatResultRows(array $rows, ?string $userId) { return $carry; } $carry[$item['node_rel_id']] = [ - 'id' => $item['node_rel_id'], - 'node_id' => $item['node_id'], - 'node_type' => $item['node_type'], - 'permissions' => $item['permissions'], + 'id' => (int)$item['node_rel_id'], + 'node_id' => (int)$item['node_id'], + 'node_type' => (int)$item['node_type'], + 'permissions' => (int)$item['permissions'], ]; return $carry; }, []); @@ -116,12 +116,12 @@ protected function formatResultRows(array $rows, ?string $userId) { if (!isset($carry[$item['page_id']])) { $carry[$item['page_id']] = ['content' => []]; } - $carry[$item['page_id']]['id'] = $item['page_id']; + $carry[$item['page_id']]['id'] = (int)$item['page_id']; $carry[$item['page_id']]['page_type'] = $item['page_type']; if ($item['node_rel_id'] !== null) { $carry[$item['page_id']]['content'][$item['content_id']] = [ - 'order' => $item['order'], - 'node_rel_id' => $item['node_rel_id'] + 'order' => (int)$item['order'], + 'node_rel_id' => (int)$item['node_rel_id'] ]; } diff --git a/lib/Db/ContextNodeRelation.php b/lib/Db/ContextNodeRelation.php index 7981ffcd1..f3e6c4126 100644 --- a/lib/Db/ContextNodeRelation.php +++ b/lib/Db/ContextNodeRelation.php @@ -25,6 +25,10 @@ class ContextNodeRelation extends Entity implements \JsonSerializable { public function __construct() { $this->addType('id', 'integer'); + $this->addType('context_id', 'integer'); + $this->addType('node_id', 'integer'); + $this->addType('node_type', 'integer'); + $this->addType('permissions', 'integer'); } public function jsonSerialize(): array { diff --git a/lib/Db/PageContent.php b/lib/Db/PageContent.php index 45bb1e735..b91067798 100644 --- a/lib/Db/PageContent.php +++ b/lib/Db/PageContent.php @@ -21,6 +21,9 @@ class PageContent extends Entity implements \JsonSerializable { public function __construct() { $this->addType('id', 'integer'); + $this->addType('page_id', 'integer'); + $this->addType('node_rel_id', 'integer'); + $this->addType('order', 'integer'); } public function jsonSerialize(): array {