| @@ 54-70 (lines=17) @@ | ||
| 51 | * @return Member |
|
| 52 | * @throws MemberDoesNotExistException |
|
| 53 | */ |
|
| 54 | public function forceGetGroup($circleId, $groupId) { |
|
| 55 | $qb = $this->getGroupsSelectSql(); |
|
| 56 | ||
| 57 | $this->limitToGroupId($qb, $groupId); |
|
| 58 | $this->limitToCircleId($qb, $circleId); |
|
| 59 | ||
| 60 | $cursor = $qb->execute(); |
|
| 61 | $data = $cursor->fetch(); |
|
| 62 | if ($data === false) { |
|
| 63 | throw new MemberDoesNotExistException($this->l10n->t('This member does not exist')); |
|
| 64 | } |
|
| 65 | ||
| 66 | $group = Member::fromArray($this->l10n, $data); |
|
| 67 | $cursor->closeCursor(); |
|
| 68 | ||
| 69 | return $group; |
|
| 70 | } |
|
| 71 | ||
| 72 | ||
| 73 | ||
| @@ 57-70 (lines=14) @@ | ||
| 54 | * @return Circle |
|
| 55 | * @throws CircleDoesNotExistException |
|
| 56 | */ |
|
| 57 | public function forceGetCircle($circleId) { |
|
| 58 | $qb = $this->getCirclesSelectSql(); |
|
| 59 | $this->limitToId($qb, $circleId); |
|
| 60 | $cursor = $qb->execute(); |
|
| 61 | ||
| 62 | $data = $cursor->fetch(); |
|
| 63 | if ($data === false || $data === null) { |
|
| 64 | throw new CircleDoesNotExistException($this->l10n->t('Circle not found')); |
|
| 65 | } |
|
| 66 | ||
| 67 | $entry = $this->parseCirclesSelectSql($data); |
|
| 68 | ||
| 69 | return $entry; |
|
| 70 | } |
|
| 71 | ||
| 72 | ||
| 73 | /** |
|
| @@ 81-105 (lines=25) @@ | ||
| 78 | * @return Circle |
|
| 79 | * @throws CircleDoesNotExistException |
|
| 80 | */ |
|
| 81 | public function getCircle($circleId, $userId) { |
|
| 82 | $qb = $this->getCirclesSelectSql(); |
|
| 83 | ||
| 84 | $this->limitToId($qb, $circleId); |
|
| 85 | $this->leftJoinUserIdAsViewer($qb, $userId); |
|
| 86 | ||
| 87 | ||
| 88 | // $this->leftjoinOwner($qb); |
|
| 89 | // $this->buildWithMemberLevel($qb, 'u.level', $level); |
|
| 90 | // $this->buildWithCircleId($qb, 'c.id', $circleId); |
|
| 91 | // $this->buildWithOrXTypes($qb, $userId, $type, $name, $circleId); |
|
| 92 | ||
| 93 | $cursor = $qb->execute(); |
|
| 94 | $data = $cursor->fetch(); |
|
| 95 | if ($data === false || $data === null) { |
|
| 96 | throw new CircleDoesNotExistException( |
|
| 97 | $this->l10n->t('Circle not found') |
|
| 98 | ); |
|
| 99 | } |
|
| 100 | ||
| 101 | $circle = $this->parseCirclesSelectSql($data); |
|
| 102 | ||
| 103 | // if ($circle->getUser()->getLevel) |
|
| 104 | return $circle; |
|
| 105 | } |
|
| 106 | ||
| 107 | ||
| 108 | /** |
|
| @@ 209-227 (lines=19) @@ | ||
| 206 | * @return FederatedLink |
|
| 207 | * @throws FederatedLinkDoesNotExistException |
|
| 208 | */ |
|
| 209 | public function getLinkFromToken($token, $uniqueId) { |
|
| 210 | $qb = $this->getLinksSelectSql(); |
|
| 211 | $this->limitToUniqueId($qb, (string)$uniqueId); |
|
| 212 | $this->limitToToken($qb, (string)$token); |
|
| 213 | ||
| 214 | $cursor = $qb->execute(); |
|
| 215 | $data = $cursor->fetch(); |
|
| 216 | ||
| 217 | if ($data === false || $data === null) { |
|
| 218 | throw new FederatedLinkDoesNotExistException( |
|
| 219 | $this->l10n->t('Federated Link not found') |
|
| 220 | ); |
|
| 221 | } |
|
| 222 | ||
| 223 | $entry = $this->parseLinksSelectSql($data); |
|
| 224 | $cursor->closeCursor(); |
|
| 225 | ||
| 226 | return $entry; |
|
| 227 | } |
|
| 228 | ||
| 229 | ||
| 230 | /** |
|
| @@ 238-255 (lines=18) @@ | ||
| 235 | * @return FederatedLink |
|
| 236 | * @throws FederatedLinkDoesNotExistException |
|
| 237 | */ |
|
| 238 | public function getLinkFromId($linkId) { |
|
| 239 | $qb = $this->getLinksSelectSql(); |
|
| 240 | $this->limitToId($qb, (string)$linkId); |
|
| 241 | ||
| 242 | $cursor = $qb->execute(); |
|
| 243 | $data = $cursor->fetch(); |
|
| 244 | $cursor->closeCursor(); |
|
| 245 | ||
| 246 | if ($data === false || $data === null) { |
|
| 247 | throw new FederatedLinkDoesNotExistException( |
|
| 248 | $this->l10n->t('Federated Link not found') |
|
| 249 | ); |
|
| 250 | } |
|
| 251 | ||
| 252 | $entry = $this->parseLinksSelectSql($data); |
|
| 253 | ||
| 254 | return $entry; |
|
| 255 | } |
|
| 256 | ||
| 257 | ||
| 258 | /** |
|