PHPdoc and small fixes
This commit is contained in:
@@ -28,7 +28,7 @@ class CardArchivedException extends \Exception {
|
||||
* Constructor
|
||||
* @param string $msg the error message
|
||||
*/
|
||||
public function __construct($msg){
|
||||
public function __construct($msg=""){
|
||||
parent::__construct($msg);
|
||||
}
|
||||
}
|
||||
@@ -49,10 +49,10 @@ class BoardController extends Controller {
|
||||
$this->userManager = $userManager;
|
||||
$this->groupManager = $groupManager;
|
||||
$this->boardService = $cardService;
|
||||
$this->userInfo = $this->getBoardPrequisites();
|
||||
$this->userInfo = $this->getBoardPrerequisites();
|
||||
}
|
||||
|
||||
private function getBoardPrequisites() {
|
||||
private function getBoardPrerequisites() {
|
||||
$groups = $this->groupManager->getUserGroupIds($this->userManager->get($this->userId));
|
||||
return [
|
||||
'user' => $this->userId,
|
||||
@@ -68,66 +68,93 @@ class BoardController extends Controller {
|
||||
return $this->boardService->findAll($this->userInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireReadPermission
|
||||
*/
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireReadPermission
|
||||
* @param $boardId
|
||||
* @return \OCP\AppFramework\Db\Entity
|
||||
*/
|
||||
public function read($boardId) {
|
||||
return $this->boardService->find($this->userId, $boardId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireNoPermission
|
||||
*/
|
||||
* @param $title
|
||||
* @param $color
|
||||
* @return \OCP\AppFramework\Db\Entity
|
||||
*/
|
||||
public function create($title, $color) {
|
||||
return $this->boardService->create($title, $this->userId, $color);
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireManagePermission
|
||||
*/
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireManagePermission
|
||||
* @param $id
|
||||
* @param $title
|
||||
* @param $color
|
||||
* @return \OCP\AppFramework\Db\Entity
|
||||
*/
|
||||
public function update($id, $title, $color) {
|
||||
return $this->boardService->update($id, $title, $this->userId, $color);
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireManagePermission
|
||||
*/
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireManagePermission
|
||||
* @param $boardId
|
||||
* @return \OCP\AppFramework\Db\Entity
|
||||
*/
|
||||
public function delete($boardId) {
|
||||
return $this->boardService->delete($this->userId, $boardId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireReadPermission
|
||||
*/
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireReadPermission
|
||||
* @param $boardId
|
||||
* @return
|
||||
*/
|
||||
public function labels($boardId) {
|
||||
return $this->boardService->labels($boardId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireManagePermission
|
||||
*/
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireManagePermission
|
||||
* @param $boardId
|
||||
* @param $type
|
||||
* @param $participant
|
||||
* @param $write
|
||||
* @param $invite
|
||||
* @param $manage
|
||||
* @return \OCP\AppFramework\Db\Entity
|
||||
*/
|
||||
public function addAcl($boardId, $type, $participant, $write, $invite, $manage) {
|
||||
return $this->boardService->addAcl($boardId, $type, $participant, $write, $invite, $manage);
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireManagePermission
|
||||
*/
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireManagePermission
|
||||
* @param $id
|
||||
* @param $permissionWrite
|
||||
* @param $permissionInvite
|
||||
* @param $permissionManage
|
||||
* @return \OCP\AppFramework\Db\Entity
|
||||
*/
|
||||
public function updateAcl($id, $permissionWrite, $permissionInvite, $permissionManage) {
|
||||
return $this->boardService->updateAcl($id, $permissionWrite, $permissionInvite, $permissionManage);
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireManagePermission
|
||||
*/
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireManagePermission
|
||||
* @param $aclId
|
||||
* @return \OCP\AppFramework\Db\Entity
|
||||
*/
|
||||
public function deleteAcl($aclId) {
|
||||
return $this->boardService->deleteAcl($aclId);
|
||||
}
|
||||
|
||||
@@ -39,74 +39,114 @@ class CardController extends Controller {
|
||||
$this->userId = $userId;
|
||||
$this->cardService = $cardService;
|
||||
}
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireReadPermission
|
||||
*/
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireReadPermission
|
||||
* @param $cardId
|
||||
* @return \OCP\AppFramework\Db\Entity
|
||||
*/
|
||||
public function read($cardId) {
|
||||
return $this->cardService->find($this->userId, $cardId);
|
||||
}
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireEditPermission
|
||||
*/
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireEditPermission
|
||||
* @param $cardId
|
||||
* @param $stackId
|
||||
* @param $order
|
||||
* @return array
|
||||
*/
|
||||
public function reorder($cardId, $stackId, $order) {
|
||||
return $this->cardService->reorder($cardId, $stackId, $order);
|
||||
}
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireEditPermission
|
||||
*/
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireEditPermission
|
||||
* @param $cardId
|
||||
* @param $title
|
||||
* @return \OCP\AppFramework\Db\Entity
|
||||
*/
|
||||
public function rename($cardId, $title) {
|
||||
return $this->cardService->rename($cardId, $title);
|
||||
}
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireEditPermission
|
||||
*/
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireEditPermission
|
||||
* @param $title
|
||||
* @param $stackId
|
||||
* @param $type
|
||||
* @param int $order
|
||||
* @return \OCP\AppFramework\Db\Entity
|
||||
*/
|
||||
public function create($title, $stackId, $type, $order=999) {
|
||||
return $this->cardService->create($title, $stackId, $type, $order, $this->userId);
|
||||
}
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireEditPermission
|
||||
*/
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireEditPermission
|
||||
* @param $id
|
||||
* @param $title
|
||||
* @param $stackId
|
||||
* @param $type
|
||||
* @param $order
|
||||
* @param $description
|
||||
* @return \OCP\AppFramework\Db\Entity
|
||||
*/
|
||||
public function update($id, $title, $stackId, $type, $order, $description) {
|
||||
return $this->cardService->update($id, $title, $stackId, $type, $order, $description, $this->userId);
|
||||
}
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireEditPermission
|
||||
*/
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireEditPermission
|
||||
* @param $cardId
|
||||
* @return \OCP\AppFramework\Db\Entity
|
||||
*/
|
||||
public function delete($cardId) {
|
||||
return $this->cardService->delete($this->userId, $cardId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireEditPermission
|
||||
*/
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireEditPermission
|
||||
* @param $cardId
|
||||
* @return \OCP\AppFramework\Db\Entity
|
||||
*/
|
||||
public function archive($cardId) {
|
||||
return $this->cardService->archive($cardId);
|
||||
}
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireEditPermission
|
||||
*/
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireEditPermission
|
||||
* @param $cardId
|
||||
* @return \OCP\AppFramework\Db\Entity
|
||||
*/
|
||||
public function unarchive($cardId) {
|
||||
return $this->cardService->unarchive($cardId);
|
||||
}
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireEditPermission
|
||||
*/
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireEditPermission
|
||||
* @param $cardId
|
||||
* @param $labelId
|
||||
*/
|
||||
public function assignLabel($cardId, $labelId) {
|
||||
return $this->cardService->assignLabel($this->userId, $cardId, $labelId);
|
||||
}
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireEditPermission
|
||||
*/
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireEditPermission
|
||||
* @param $cardId
|
||||
* @param $labelId
|
||||
*/
|
||||
public function removeLabel($cardId, $labelId) {
|
||||
return $this->cardService->removeLabel($this->userId, $cardId, $labelId);
|
||||
}
|
||||
|
||||
@@ -42,24 +42,36 @@ class LabelController extends Controller {
|
||||
$this->labelService = $labelService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireManagePermission
|
||||
*/
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireManagePermission
|
||||
* @param $title
|
||||
* @param $color
|
||||
* @param $boardId
|
||||
* @return \OCP\AppFramework\Db\Entity
|
||||
*/
|
||||
public function create($title, $color, $boardId) {
|
||||
return $this->labelService->create($title, $this->userId, $color, $boardId);
|
||||
}
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireManagePermission
|
||||
*/
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireManagePermission
|
||||
* @param $id
|
||||
* @param $title
|
||||
* @param $color
|
||||
* @return \OCP\AppFramework\Db\Entity
|
||||
*/
|
||||
public function update($id, $title, $color) {
|
||||
return $this->labelService->update($id, $title, $this->userId, $color);
|
||||
}
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireManagePermission
|
||||
*/
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireManagePermission
|
||||
* @param $labelId
|
||||
* @return \OCP\AppFramework\Db\Entity
|
||||
*/
|
||||
public function delete($labelId) {
|
||||
return $this->labelService->delete($this->userId, $labelId);
|
||||
}
|
||||
|
||||
@@ -47,10 +47,13 @@ class ShareController extends Controller {
|
||||
$this->userId = $userId;
|
||||
|
||||
}
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireNoPermission
|
||||
*/
|
||||
* @param $search
|
||||
* @return array
|
||||
*/
|
||||
public function searchUser($search) {
|
||||
$limit = 3;
|
||||
$offset = null;
|
||||
|
||||
@@ -41,45 +41,68 @@ class StackController extends Controller {
|
||||
$this->userId = $userId;
|
||||
$this->stackService = $cardService;
|
||||
}
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireReadPermission
|
||||
*/
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireReadPermission
|
||||
* @param $boardId
|
||||
* @return array
|
||||
*/
|
||||
public function index($boardId) {
|
||||
return $this->stackService->findAll($boardId);
|
||||
}
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireReadPermission
|
||||
*/
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireReadPermission
|
||||
* @param $boardId
|
||||
* @return array
|
||||
*/
|
||||
public function archived($boardId) {
|
||||
return $this->stackService->findAllArchived($boardId);
|
||||
}
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireReadPermission
|
||||
*/
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireReadPermission
|
||||
* @param $boardId
|
||||
* @return
|
||||
*/
|
||||
public function read($boardId) {
|
||||
return $this->stackService->find($this->userId, $boardId);
|
||||
}
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireManagePermission
|
||||
*/
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireManagePermission
|
||||
* @param $title
|
||||
* @param $boardId
|
||||
* @param int $order
|
||||
* @return \OCP\AppFramework\Db\Entity
|
||||
*/
|
||||
public function create($title, $boardId, $order=999) {
|
||||
return $this->stackService->create($title, $boardId, $order);
|
||||
}
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireManagePermission
|
||||
*/
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireManagePermission
|
||||
* @param $id
|
||||
* @param $title
|
||||
* @param $boardId
|
||||
* @param $order
|
||||
* @return \OCP\AppFramework\Db\Entity
|
||||
*/
|
||||
public function update($id, $title, $boardId, $order) {
|
||||
return $this->stackService->update($id, $title, $boardId, $order);
|
||||
}
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireManagePermission
|
||||
*/
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @RequireManagePermission
|
||||
* @param $stackId
|
||||
* @return \OCP\AppFramework\Db\Entity
|
||||
*/
|
||||
public function delete($stackId) {
|
||||
return $this->stackService->delete($this->userId, $stackId);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace OCA\Deck\Db;
|
||||
|
||||
use JsonSerializable;
|
||||
|
||||
class Board extends \OCA\Deck\Db\Entity implements JsonSerializable {
|
||||
class Board extends Entity implements JsonSerializable {
|
||||
|
||||
public $id;
|
||||
protected $title;
|
||||
|
||||
@@ -40,10 +40,10 @@ class BoardMapper extends DeckMapper implements IPermissionMapper {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @throws \OCP\AppFramework\Db\DoesNotExistException if not found
|
||||
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException if more than one result
|
||||
*/
|
||||
/**
|
||||
* @param $id
|
||||
* @return \OCP\AppFramework\Db\Entity if not found
|
||||
*/
|
||||
public function find($id) {
|
||||
$sql = 'SELECT id, title, owner, color, archived FROM `*PREFIX*deck_boards` ' .
|
||||
'WHERE `id` = ?';
|
||||
@@ -79,13 +79,16 @@ class BoardMapper extends DeckMapper implements IPermissionMapper {
|
||||
}
|
||||
return $entries;
|
||||
}
|
||||
/**
|
||||
* Find all boards for a given user
|
||||
* @param $groups
|
||||
* @param null $limit
|
||||
* @param null $offset
|
||||
* @return array
|
||||
*/
|
||||
|
||||
/**
|
||||
* Find all boards for a given user
|
||||
*
|
||||
* @param $userId
|
||||
* @param $groups
|
||||
* @param null $limit
|
||||
* @param null $offset
|
||||
* @return array
|
||||
*/
|
||||
public function findAllByGroups($userId, $groups, $limit=null, $offset=null) {
|
||||
if(count($groups)<=0) {
|
||||
return [];
|
||||
|
||||
@@ -54,10 +54,10 @@ class CardMapper extends Mapper implements IPermissionMapper {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @throws \OCP\AppFramework\Db\DoesNotExistException if not found
|
||||
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException if more than one result
|
||||
*/
|
||||
/**
|
||||
* @param $id
|
||||
* @return Entity if not found
|
||||
*/
|
||||
public function find($id) {
|
||||
$sql = 'SELECT * FROM `*PREFIX*deck_cards` ' .
|
||||
'WHERE `id` = ?';
|
||||
@@ -68,7 +68,6 @@ class CardMapper extends Mapper implements IPermissionMapper {
|
||||
}
|
||||
|
||||
public function findAll($stackId, $limit=null, $offset=null) {
|
||||
// TODO: Exclude fields like text
|
||||
$sql = 'SELECT * FROM `*PREFIX*deck_cards`
|
||||
WHERE `stack_id` = ? AND NOT archived ORDER BY `order`';
|
||||
$entities = $this->findEntities($sql, [$stackId], $limit, $offset);
|
||||
|
||||
@@ -28,8 +28,8 @@ use OCP\AppFramework\Db\Mapper;
|
||||
abstract class DeckMapper extends Mapper {
|
||||
|
||||
/**
|
||||
* @throws \OCP\AppFramework\Db\DoesNotExistException if not found
|
||||
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException if more than one result
|
||||
* @param $id
|
||||
* @return \OCP\AppFramework\Db\Entity if not found
|
||||
*/
|
||||
public function find($id) {
|
||||
$sql = 'SELECT * FROM `' . $this->tableName . '` ' . 'WHERE `id` = ?';
|
||||
|
||||
@@ -27,8 +27,6 @@ namespace OCA\Deck\Db;
|
||||
|
||||
interface IPermissionMapper {
|
||||
|
||||
// FIXME: Optimize implementations as e.g. BoardMapper::isOwner doesn't need to select all fields
|
||||
|
||||
/**
|
||||
* Check if $userId is owner of Entity with $id
|
||||
*
|
||||
|
||||
@@ -60,7 +60,7 @@ class LabelMapper extends DeckMapper implements IPermissionMapper {
|
||||
$labels = $this->findAssignedLabelsForBoard($boardId);
|
||||
$result = array();
|
||||
foreach ($labels as $label) {
|
||||
if(!is_array($result[$label->getCardId()])) {
|
||||
if(!array_key_exists($label->getCardId(), $result)) {
|
||||
$result[$label->getCardId()] = array();
|
||||
}
|
||||
$result[$label->getCardId()][] = $label;
|
||||
|
||||
@@ -38,10 +38,10 @@ class StackMapper extends Mapper implements IPermissionMapper {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @throws \OCP\AppFramework\Db\DoesNotExistException if not found
|
||||
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException if more than one result
|
||||
*/
|
||||
/**
|
||||
* @param $id
|
||||
* @return Entity if not found
|
||||
*/
|
||||
public function find($id) {
|
||||
$sql = 'SELECT * FROM `*PREFIX*deck_stacks` ' .
|
||||
'WHERE `id` = ?';
|
||||
|
||||
@@ -191,6 +191,7 @@ class SharingMiddleware extends Middleware {
|
||||
* @param $mapper
|
||||
* @param $id
|
||||
* @return bool
|
||||
* @throws NotFoundException
|
||||
*/
|
||||
public function checkMapperPermission($permission, $userId, $mapper, $id) {
|
||||
// check if current user is owner
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace OCA\Deck;
|
||||
|
||||
class NotFoundException extends \Exception {
|
||||
|
||||
public function __construct($message) {
|
||||
public function __construct($message="") {
|
||||
parent::__construct($message);
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,6 @@ use OCA\Deck\Db\Label;
|
||||
use OCP\ILogger;
|
||||
use OCP\IL10N;
|
||||
|
||||
use OCP\AppFramework\Utility\ITimeFactory;
|
||||
|
||||
use \OCA\Deck\Db\Board;
|
||||
use \OCA\Deck\Db\BoardMapper;
|
||||
|
||||
@@ -27,8 +27,6 @@ use OCA\Deck\Db\Label;
|
||||
use OCP\ILogger;
|
||||
use OCP\IL10N;
|
||||
|
||||
use OCP\AppFramework\Utility\ITimeFactory;
|
||||
|
||||
|
||||
use \OCA\Deck\Db\LabelMapper;
|
||||
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2016 Julius Härtl <jus@bitgrid.net>
|
||||
*
|
||||
* @author Julius Härtl <jus@bitgrid.net>
|
||||
*
|
||||
* @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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OCA\Deck\Service;
|
||||
|
||||
class ServicePermissionException extends \Exception {
|
||||
/**
|
||||
* Constructor
|
||||
* @param string $msg the error message
|
||||
*/
|
||||
public function __construct($msg){
|
||||
parent::__construct($msg);
|
||||
}
|
||||
}
|
||||
@@ -54,13 +54,14 @@ class StackService {
|
||||
public function findAll($boardId) {
|
||||
$stacks = $this->stackMapper->findAll($boardId);
|
||||
$labels = $this->labelMapper->getAssignedLabelsForBoard($boardId);
|
||||
|
||||
foreach ($stacks as $idx => $s) {
|
||||
$cards = $this->cardMapper->findAll($s->id);
|
||||
foreach ($cards as $idxc => $card) {
|
||||
$cards[$idxc]->setLabels($labels[$card->id]);
|
||||
foreach ($stacks as $stackIndex => $stack) {
|
||||
$cards = $this->cardMapper->findAll($stack->id);
|
||||
foreach ($cards as $cardIndex => $card) {
|
||||
if(array_key_exists($card->id, $labels)) {
|
||||
$cards[$cardIndex]->setLabels($labels[$card->id]);
|
||||
}
|
||||
}
|
||||
$stacks[$idx]->setCards($cards);
|
||||
$stacks[$stackIndex]->setCards($cards);
|
||||
}
|
||||
return $stacks;
|
||||
}
|
||||
@@ -68,12 +69,14 @@ class StackService {
|
||||
public function findAllArchived($boardId) {
|
||||
$stacks = $this->stackMapper->findAll($boardId);
|
||||
$labels = $this->labelMapper->getAssignedLabelsForBoard($boardId);
|
||||
foreach ($stacks as $idx => $s) {
|
||||
$cards = $this->cardMapper->findAllArchived($s->id);
|
||||
foreach ($cards as $idxc => $card) {
|
||||
$cards[$idxc]->setLabels($labels[$card->id]);
|
||||
foreach ($stacks as $stackIndex => $stack) {
|
||||
$cards = $this->cardMapper->findAllArchived($stack->id);
|
||||
foreach ($cards as $cardIndex => $card) {
|
||||
if(array_key_exists($card->id, $labels)) {
|
||||
$cards[$cardIndex]->setLabels($labels[$card->id]);
|
||||
}
|
||||
}
|
||||
$stacks[$idx]->setCards($cards);
|
||||
$stacks[$stackIndex]->setCards($cards);
|
||||
}
|
||||
return $stacks;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user