| @@ 111-128 (lines=18) @@ | ||
| 108 | * @return null|Circle |
|
| 109 | * @throws CircleDoesNotExistException |
|
| 110 | */ |
|
| 111 | public function forceGetCircleByName($name) { |
|
| 112 | ||
| 113 | $qb = $this->getCirclesSelectSql(); |
|
| 114 | ||
| 115 | $this->limitToName($qb, $name); |
|
| 116 | ||
| 117 | $cursor = $qb->execute(); |
|
| 118 | $data = $cursor->fetch(); |
|
| 119 | $cursor->closeCursor(); |
|
| 120 | ||
| 121 | if ($data === false) { |
|
| 122 | throw new CircleDoesNotExistException($this->l10n->t('Circle not found')); |
|
| 123 | } |
|
| 124 | ||
| 125 | $entry = $this->parseCirclesSelectSql($data); |
|
| 126 | ||
| 127 | return $entry; |
|
| 128 | } |
|
| 129 | ||
| 130 | ||
| 131 | /** |
|
| @@ 343-358 (lines=16) @@ | ||
| 340 | * @return Circle |
|
| 341 | * @throws CircleDoesNotExistException |
|
| 342 | */ |
|
| 343 | public function getCircleFromUniqueId($uniqueId) { |
|
| 344 | $qb = $this->getCirclesSelectSql(); |
|
| 345 | $this->limitToUniqueId($qb, (string)$uniqueId); |
|
| 346 | ||
| 347 | $cursor = $qb->execute(); |
|
| 348 | $data = $cursor->fetch(); |
|
| 349 | $cursor->closeCursor(); |
|
| 350 | ||
| 351 | if ($data === false) { |
|
| 352 | throw new CircleDoesNotExistException($this->l10n->t('Circle not found')); |
|
| 353 | } |
|
| 354 | ||
| 355 | $entry = $this->parseCirclesSelectSql($data); |
|
| 356 | ||
| 357 | return $entry; |
|
| 358 | } |
|
| 359 | ||
| 360 | ||
| 361 | /** |
|
| @@ 408-422 (lines=15) @@ | ||
| 405 | * @return Circle |
|
| 406 | * @throws CircleDoesNotExistException |
|
| 407 | */ |
|
| 408 | public function getFromContactGroup(int $addressBookId, string $group): Circle { |
|
| 409 | $qb = $this->getCirclesSelectSql(); |
|
| 410 | $this->limitToAddressBookId($qb, $addressBookId); |
|
| 411 | $this->limitToContactGroup($qb, $group); |
|
| 412 | ||
| 413 | $cursor = $qb->execute(); |
|
| 414 | $data = $cursor->fetch(); |
|
| 415 | $cursor->closeCursor(); |
|
| 416 | ||
| 417 | if ($data === false) { |
|
| 418 | throw new CircleDoesNotExistException($this->l10n->t('Circle not found')); |
|
| 419 | } |
|
| 420 | ||
| 421 | return $this->parseCirclesSelectSql($data); |
|
| 422 | } |
|
| 423 | ||
| 424 | } |
|
| 425 | ||
| @@ 51-63 (lines=13) @@ | ||
| 48 | * @return SharesToken |
|
| 49 | * @throws TokenDoesNotExistException |
|
| 50 | */ |
|
| 51 | public function getByToken(string $token) { |
|
| 52 | $qb = $this->getTokensSelectSql(); |
|
| 53 | $this->limitToToken($qb, $token); |
|
| 54 | ||
| 55 | $cursor = $qb->execute(); |
|
| 56 | $data = $cursor->fetch(); |
|
| 57 | $cursor->closeCursor(); |
|
| 58 | if ($data === false) { |
|
| 59 | throw new TokenDoesNotExistException('Unknown share token'); |
|
| 60 | } |
|
| 61 | ||
| 62 | return $this->parseTokensSelectSql($data); |
|
| 63 | } |
|
| 64 | ||
| 65 | ||
| 66 | /** |
|
| @@ 434-448 (lines=15) @@ | ||
| 431 | * @return Share |
|
| 432 | * @throws ShareNotFound |
|
| 433 | */ |
|
| 434 | public function getShareById($shareId, $recipientId = null) { |
|
| 435 | $qb = $this->getBaseSelectSql(); |
|
| 436 | ||
| 437 | $this->limitToShare($qb, $shareId); |
|
| 438 | ||
| 439 | $cursor = $qb->execute(); |
|
| 440 | $data = $cursor->fetch(); |
|
| 441 | $cursor->closeCursor(); |
|
| 442 | ||
| 443 | if ($data === false) { |
|
| 444 | throw new ShareNotFound(); |
|
| 445 | } |
|
| 446 | ||
| 447 | return $this->createShareObject($data); |
|
| 448 | } |
|
| 449 | ||
| 450 | ||
| 451 | /** |
|
| @@ 640-654 (lines=15) @@ | ||
| 637 | * @return Member |
|
| 638 | * @throws MemberDoesNotExistException |
|
| 639 | */ |
|
| 640 | public function getContactMember(string $circleId, string $contactId): Member { |
|
| 641 | $qb = $this->getMembersSelectSql(); |
|
| 642 | $this->limitToContactId($qb, $contactId); |
|
| 643 | $this->limitToCircleId($qb, $circleId); |
|
| 644 | ||
| 645 | $cursor = $qb->execute(); |
|
| 646 | $data = $cursor->fetch(); |
|
| 647 | $cursor->closeCursor(); |
|
| 648 | ||
| 649 | if ($data === false) { |
|
| 650 | throw new MemberDoesNotExistException($this->l10n->t('This member does not exist')); |
|
| 651 | } |
|
| 652 | ||
| 653 | return $this->parseMembersSelectSql($data); |
|
| 654 | } |
|
| 655 | ||
| 656 | ||
| 657 | /** |
|