| @@ 149-165 (lines=17) @@ | ||
| 146 | * @return Member |
|
| 147 | * @throws MemberDoesNotExistException |
|
| 148 | */ |
|
| 149 | public function forceGetGroup($circleUniqueId, $groupId) { |
|
| 150 | $qb = $this->getGroupsSelectSql(); |
|
| 151 | ||
| 152 | $this->limitToGroupId($qb, $groupId); |
|
| 153 | $this->limitToCircleId($qb, $circleUniqueId); |
|
| 154 | ||
| 155 | $cursor = $qb->execute(); |
|
| 156 | $data = $cursor->fetch(); |
|
| 157 | if ($data === false) { |
|
| 158 | throw new MemberDoesNotExistException($this->l10n->t('This member does not exist')); |
|
| 159 | } |
|
| 160 | ||
| 161 | $group = $this->parseGroupsSelectSql($data); |
|
| 162 | $cursor->closeCursor(); |
|
| 163 | ||
| 164 | return $group; |
|
| 165 | } |
|
| 166 | ||
| 167 | ||
| 168 | /** |
|
| @@ 53-71 (lines=19) @@ | ||
| 50 | * @return Member |
|
| 51 | * @throws MemberDoesNotExistException |
|
| 52 | */ |
|
| 53 | public function forceGetMember($circleUniqueId, $userId, $type) { |
|
| 54 | $qb = $this->getMembersSelectSql(); |
|
| 55 | ||
| 56 | $this->limitToUserId($qb, $userId); |
|
| 57 | $this->limitToUserType($qb, $type); |
|
| 58 | $this->limitToCircleId($qb, $circleUniqueId); |
|
| 59 | ||
| 60 | $cursor = $qb->execute(); |
|
| 61 | $data = $cursor->fetch(); |
|
| 62 | $cursor->closeCursor(); |
|
| 63 | ||
| 64 | if ($data === false) { |
|
| 65 | throw new MemberDoesNotExistException($this->l10n->t('This member does not exist')); |
|
| 66 | } |
|
| 67 | ||
| 68 | $member = $this->parseMembersSelectSql($data); |
|
| 69 | ||
| 70 | return $member; |
|
| 71 | } |
|
| 72 | ||
| 73 | ||
| 74 | /** |
|
| @@ 157-171 (lines=15) @@ | ||
| 154 | * @return FederatedLink |
|
| 155 | * @throws FederatedLinkDoesNotExistException |
|
| 156 | */ |
|
| 157 | public function getLinkFromCircle($circleUniqueId, $linkUniqueId) { |
|
| 158 | $qb = $this->getLinksSelectSql(); |
|
| 159 | $this->limitToCircleId($qb, $circleUniqueId); |
|
| 160 | $this->limitToUniqueId($qb, $linkUniqueId); |
|
| 161 | ||
| 162 | $cursor = $qb->execute(); |
|
| 163 | $data = $cursor->fetch(); |
|
| 164 | $cursor->closeCursor(); |
|
| 165 | ||
| 166 | if ($data === false) { |
|
| 167 | throw new FederatedLinkDoesNotExistException($this->l10n->t('Federated link not found')); |
|
| 168 | } |
|
| 169 | ||
| 170 | return $this->parseLinksSelectSql($data); |
|
| 171 | } |
|
| 172 | ||
| 173 | ||
| 174 | /** |
|
| @@ 183-197 (lines=15) @@ | ||
| 180 | * @return FederatedLink |
|
| 181 | * @throws FederatedLinkDoesNotExistException |
|
| 182 | */ |
|
| 183 | public function getLinkFromToken($token, $uniqueId) { |
|
| 184 | $qb = $this->getLinksSelectSql(); |
|
| 185 | $this->limitToUniqueId($qb, (string)$uniqueId); |
|
| 186 | $this->limitToToken($qb, (string)$token); |
|
| 187 | ||
| 188 | $cursor = $qb->execute(); |
|
| 189 | $data = $cursor->fetch(); |
|
| 190 | $cursor->closeCursor(); |
|
| 191 | ||
| 192 | if ($data === false) { |
|
| 193 | throw new FederatedLinkDoesNotExistException($this->l10n->t('Federated link not found')); |
|
| 194 | } |
|
| 195 | ||
| 196 | return $this->parseLinksSelectSql($data); |
|
| 197 | } |
|
| 198 | ||
| 199 | ||
| 200 | /** |
|
| @@ 208-223 (lines=16) @@ | ||
| 205 | * @return FederatedLink |
|
| 206 | * @throws FederatedLinkDoesNotExistException |
|
| 207 | */ |
|
| 208 | public function getLinkFromId($linkUniqueId) { |
|
| 209 | $qb = $this->getLinksSelectSql(); |
|
| 210 | $this->limitToShortenUniqueId($qb, $linkUniqueId, FederatedLink::SHORT_UNIQUE_ID_LENGTH); |
|
| 211 | ||
| 212 | $cursor = $qb->execute(); |
|
| 213 | $data = $cursor->fetch(); |
|
| 214 | $cursor->closeCursor(); |
|
| 215 | ||
| 216 | if ($data === false) { |
|
| 217 | throw new FederatedLinkDoesNotExistException($this->l10n->t('Federated link not found')); |
|
| 218 | } |
|
| 219 | ||
| 220 | $entry = $this->parseLinksSelectSql($data); |
|
| 221 | ||
| 222 | return $entry; |
|
| 223 | } |
|
| 224 | ||
| 225 | ||
| 226 | } |
|
| @@ 365-380 (lines=16) @@ | ||
| 362 | * @return Circle |
|
| 363 | * @throws CircleDoesNotExistException |
|
| 364 | */ |
|
| 365 | public function getCircleFromUniqueId($uniqueId) { |
|
| 366 | $qb = $this->getCirclesSelectSql(); |
|
| 367 | $this->limitToUniqueId($qb, (string)$uniqueId); |
|
| 368 | ||
| 369 | $cursor = $qb->execute(); |
|
| 370 | $data = $cursor->fetch(); |
|
| 371 | $cursor->closeCursor(); |
|
| 372 | ||
| 373 | if ($data === false) { |
|
| 374 | throw new CircleDoesNotExistException($this->l10n->t('Circle not found')); |
|
| 375 | } |
|
| 376 | ||
| 377 | $entry = $this->parseCirclesSelectSql($data); |
|
| 378 | ||
| 379 | return $entry; |
|
| 380 | } |
|
| 381 | ||
| 382 | ||
| 383 | /** |
|
| @@ 390-409 (lines=20) @@ | ||
| 387 | * @return SharingFrame |
|
| 388 | * @throws SharingFrameDoesNotExistException |
|
| 389 | */ |
|
| 390 | public function getFrame($circleUniqueId, $frameUniqueId) { |
|
| 391 | $qb = $this->getSharesSelectSql(); |
|
| 392 | $this->limitToUniqueId($qb, $frameUniqueId); |
|
| 393 | $this->limitToCircleId($qb, $circleUniqueId); |
|
| 394 | $this->leftJoinCircle($qb); |
|
| 395 | ||
| 396 | $cursor = $qb->execute(); |
|
| 397 | $data = $cursor->fetch(); |
|
| 398 | $cursor->closeCursor(); |
|
| 399 | ||
| 400 | if ($data === false) { |
|
| 401 | throw new SharingFrameDoesNotExistException($this->l10n->t('Sharing Frame does not exist')); |
|
| 402 | } |
|
| 403 | ||
| 404 | $entry = $this->parseSharesSelectSql($data); |
|
| 405 | ||
| 406 | return $entry; |
|
| 407 | } |
|
| 408 | ||
| 409 | ||
| 410 | } |
|