diff --git a/lib/Db/RelationalEntity.php b/lib/Db/RelationalEntity.php index 7f21a9a7e..c0b180c62 100644 --- a/lib/Db/RelationalEntity.php +++ b/lib/Db/RelationalEntity.php @@ -86,6 +86,10 @@ class RelationalEntity extends Entity implements \JsonSerializable { return $json; } + public function __toString(): string { + return (string)$this->getId(); + } + /* * Resolve relational data from external methods * diff --git a/lib/Service/BoardService.php b/lib/Service/BoardService.php index 4bfa6e0e8..b5e60a625 100644 --- a/lib/Service/BoardService.php +++ b/lib/Service/BoardService.php @@ -119,15 +119,7 @@ class BoardService { $userBoards = $this->boardMapper->findAllByUser($userInfo['user'], null, null, $since, $includeArchived); $groupBoards = $this->boardMapper->findAllByGroups($userInfo['user'], $userInfo['groups'],null, null, $since, $includeArchived); $circleBoards = $this->boardMapper->findAllByCircles($userInfo['user'], null, null, $since, $includeArchived); - $mergedBoards = array_merge($userBoards, $groupBoards, $circleBoards); - $result = []; - /** @var Board $item */ - foreach ($mergedBoards as &$item) { - if (!array_key_exists($item->getId(), $result)) { - $result[$item->getId()] = $item; - } - } - return array_values($result); + return array_unique(array_merge($userBoards, $groupBoards, $circleBoards)); } /** * @return array diff --git a/lib/Service/OverviewService.php b/lib/Service/OverviewService.php index 6d514cd32..7c458449b 100644 --- a/lib/Service/OverviewService.php +++ b/lib/Service/OverviewService.php @@ -140,7 +140,7 @@ class OverviewService { $userBoards = $this->boardMapper->findAllByUser($userInfo['user'], null, null); $groupBoards = $this->boardMapper->findAllByGroups($userInfo['user'], $userInfo['groups'],null, null); $circleBoards = $this->boardMapper->findAllByCircles($userInfo['user'], null, null); - return array_merge($userBoards, $groupBoards, $circleBoards); + return array_unique(array_merge($userBoards, $groupBoards, $circleBoards)); } private function getBoardPrerequisites($userId): array {