From ec42c0c2b49c02091d35eb131e338a4dafc0fdad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Fri, 7 Dec 2018 17:02:18 +0100 Subject: [PATCH] Fix numeric types and missing card id in card detail results MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- lib/Db/AssignedUsers.php | 4 ++-- lib/Db/Label.php | 14 ++++++++------ lib/Db/LabelMapper.php | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/Db/AssignedUsers.php b/lib/Db/AssignedUsers.php index 425f2f184..69be2ec4e 100644 --- a/lib/Db/AssignedUsers.php +++ b/lib/Db/AssignedUsers.php @@ -33,8 +33,8 @@ class AssignedUsers extends RelationalEntity implements JsonSerializable { public function __construct() { $this->addType('id', 'integer'); - $this->addType('card_id', 'integer'); + $this->addType('cardId', 'integer'); $this->addResolvable('participant'); } -} \ No newline at end of file +} diff --git a/lib/Db/Label.php b/lib/Db/Label.php index 650af4162..47a3bc221 100644 --- a/lib/Db/Label.php +++ b/lib/Db/Label.php @@ -5,20 +5,20 @@ * @author Julius Härtl * * @license GNU AGPL version 3 or any later version - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. - * + * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - * + * */ namespace OCA\Deck\Db; @@ -29,8 +29,10 @@ class Label extends RelationalEntity { protected $color; protected $boardId; protected $cardId; - + public function __construct() { $this->addType('id', 'integer'); + $this->addType('boardId', 'integer'); + $this->addType('cardId', 'integer'); } -} \ No newline at end of file +} diff --git a/lib/Db/LabelMapper.php b/lib/Db/LabelMapper.php index 3107b4310..ec0e653d5 100644 --- a/lib/Db/LabelMapper.php +++ b/lib/Db/LabelMapper.php @@ -45,7 +45,7 @@ class LabelMapper extends DeckMapper implements IPermissionMapper { } public function findAssignedLabelsForCard($cardId, $limit = null, $offset = null) { - $sql = 'SELECT l.* FROM `*PREFIX*deck_assigned_labels` as al INNER JOIN *PREFIX*deck_labels as l ON l.id = al.label_id WHERE `card_id` = ? ORDER BY l.id'; + $sql = 'SELECT l.*,card_id FROM `*PREFIX*deck_assigned_labels` as al INNER JOIN *PREFIX*deck_labels as l ON l.id = al.label_id WHERE `card_id` = ? ORDER BY l.id'; return $this->findEntities($sql, [$cardId], $limit, $offset); } public function findAssignedLabelsForBoard($boardId, $limit = null, $offset = null) {