From d11917e4ffd14c729c49cd89f7bc4a92c842c093 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20R=C3=B6hrl?= Date: Wed, 20 Feb 2019 14:15:31 +0100 Subject: [PATCH] now the tests are working MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jakob Röhrl --- lib/Service/LabelService.php | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/lib/Service/LabelService.php b/lib/Service/LabelService.php index 2fc5658e3..6b8e09b55 100644 --- a/lib/Service/LabelService.php +++ b/lib/Service/LabelService.php @@ -93,12 +93,13 @@ class LabelService { $this->permissionService->checkPermission(null, $boardId, Acl::PERMISSION_MANAGE); //$this->checkDuplicateTitle($boardId, $title); - $boardLabels = array(); $boardLabels = $this->labelMapper->findAll($boardId); - foreach($boardLabels as $boardLabel) { - if ($boardLabel->getTitle() === $title) { - throw new BadRequestException('title must be unique'); - break; + if (is_array($boardLabels) || is_object($boardLabels)) { + foreach($boardLabels as $boardLabel) { + if ($boardLabel->getTitle() === $title) { + throw new BadRequestException('title must be unique'); + break; + } } } @@ -169,13 +170,15 @@ class LabelService { $boardLabels = array(); $boardLabels = $this->labelMapper->findAll($label->getBoardId()); - foreach($boardLabels as $boardLabel) { - if ($boardLabel->getId() === $label->getId()) { - continue; - } - if ($boardLabel->getTitle() === $title) { - throw new BadRequestException('title must be unique'); - break; + if (is_array($boardLabels) || is_object($boardLabels)) { + foreach($boardLabels as $boardLabel) { + if ($boardLabel->getId() === $label->getId()) { + continue; + } + if ($boardLabel->getTitle() === $title) { + throw new BadRequestException('title must be unique'); + break; + } } }