diff --git a/lib/Db/RelationalEntity.php b/lib/Db/RelationalEntity.php index 5da532daa..7d1ded2ee 100644 --- a/lib/Db/RelationalEntity.php +++ b/lib/Db/RelationalEntity.php @@ -83,6 +83,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 cdc348119..6ab343eec 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 8099108e6..c18cbcaf8 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 {