| @@ 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 | /** |
|
| @@ 174-190 (lines=17) @@ | ||
| 171 | * @return Member |
|
| 172 | * @throws MemberDoesNotExistException |
|
| 173 | */ |
|
| 174 | public function forceGetGroup($circleUniqueId, $groupId) { |
|
| 175 | $qb = $this->getGroupsSelectSql(); |
|
| 176 | ||
| 177 | $this->limitToGroupId($qb, $groupId); |
|
| 178 | $this->limitToCircleId($qb, $circleUniqueId); |
|
| 179 | ||
| 180 | $cursor = $qb->execute(); |
|
| 181 | $data = $cursor->fetch(); |
|
| 182 | if ($data === false) { |
|
| 183 | throw new MemberDoesNotExistException($this->l10n->t('This member does not exist')); |
|
| 184 | } |
|
| 185 | ||
| 186 | $group = $this->parseGroupsSelectSql($data); |
|
| 187 | $cursor->closeCursor(); |
|
| 188 | ||
| 189 | return $group; |
|
| 190 | } |
|
| 191 | ||
| 192 | ||
| 193 | /** |
|
| @@ 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 | } |
|
| @@ 52-68 (lines=17) @@ | ||
| 49 | * @return Circle |
|
| 50 | * @throws CircleDoesNotExistException |
|
| 51 | */ |
|
| 52 | public function forceGetCircle($circleUniqueId) { |
|
| 53 | $qb = $this->getCirclesSelectSql(); |
|
| 54 | ||
| 55 | $this->limitToShortenUniqueId($qb, $circleUniqueId, Circle::SHORT_UNIQUE_ID_LENGTH); |
|
| 56 | ||
| 57 | $cursor = $qb->execute(); |
|
| 58 | $data = $cursor->fetch(); |
|
| 59 | $cursor->closeCursor(); |
|
| 60 | ||
| 61 | if ($data === false) { |
|
| 62 | throw new CircleDoesNotExistException($this->l10n->t('Circle not found')); |
|
| 63 | } |
|
| 64 | ||
| 65 | $entry = $this->parseCirclesSelectSql($data); |
|
| 66 | ||
| 67 | return $entry; |
|
| 68 | } |
|
| 69 | ||
| 70 | ||
| 71 | /** |
|
| @@ 324-339 (lines=16) @@ | ||
| 321 | * @return Circle |
|
| 322 | * @throws CircleDoesNotExistException |
|
| 323 | */ |
|
| 324 | public function getCircleFromUniqueId($uniqueId) { |
|
| 325 | $qb = $this->getCirclesSelectSql(); |
|
| 326 | $this->limitToUniqueId($qb, (string)$uniqueId); |
|
| 327 | ||
| 328 | $cursor = $qb->execute(); |
|
| 329 | $data = $cursor->fetch(); |
|
| 330 | $cursor->closeCursor(); |
|
| 331 | ||
| 332 | if ($data === false) { |
|
| 333 | throw new CircleDoesNotExistException($this->l10n->t('Circle not found')); |
|
| 334 | } |
|
| 335 | ||
| 336 | $entry = $this->parseCirclesSelectSql($data); |
|
| 337 | ||
| 338 | return $entry; |
|
| 339 | } |
|
| 340 | ||
| 341 | ||
| 342 | ||
| @@ 50-69 (lines=20) @@ | ||
| 47 | * @return SharingFrame |
|
| 48 | * @throws SharingFrameDoesNotExistException |
|
| 49 | */ |
|
| 50 | public function getSharingFrame($circleUniqueId, $frameUniqueId) { |
|
| 51 | $qb = $this->getSharesSelectSql(); |
|
| 52 | $this->limitToUniqueId($qb, $frameUniqueId); |
|
| 53 | $this->limitToCircleId($qb, $circleUniqueId); |
|
| 54 | $this->leftJoinCircle($qb); |
|
| 55 | ||
| 56 | $cursor = $qb->execute(); |
|
| 57 | $data = $cursor->fetch(); |
|
| 58 | $cursor->closeCursor(); |
|
| 59 | ||
| 60 | if ($data === false) { |
|
| 61 | throw new SharingFrameDoesNotExistException($this->l10n->t('Sharing Frame does not exist')); |
|
| 62 | } |
|
| 63 | ||
| 64 | $entry = $this->parseSharesSelectSql($data); |
|
| 65 | ||
| 66 | return $entry; |
|
| 67 | } |
|
| 68 | ||
| 69 | ||
| 70 | /** |
|
| 71 | * @param string $circleUniqueId |
|
| 72 | * |
|