| @@ 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 | /** |
|
| @@ 344-359 (lines=16) @@ | ||
| 341 | * @return Circle |
|
| 342 | * @throws CircleDoesNotExistException |
|
| 343 | */ |
|
| 344 | public function getCircleFromUniqueId($uniqueId) { |
|
| 345 | $qb = $this->getCirclesSelectSql(); |
|
| 346 | $this->limitToUniqueId($qb, (string)$uniqueId); |
|
| 347 | ||
| 348 | $cursor = $qb->execute(); |
|
| 349 | $data = $cursor->fetch(); |
|
| 350 | $cursor->closeCursor(); |
|
| 351 | ||
| 352 | if ($data === false) { |
|
| 353 | throw new CircleDoesNotExistException($this->l10n->t('Circle not found')); |
|
| 354 | } |
|
| 355 | ||
| 356 | $entry = $this->parseCirclesSelectSql($data); |
|
| 357 | ||
| 358 | return $entry; |
|
| 359 | } |
|
| 360 | ||
| 361 | ||
| 362 | /** |
|
| @@ 409-423 (lines=15) @@ | ||
| 406 | * @return Circle |
|
| 407 | * @throws CircleDoesNotExistException |
|
| 408 | */ |
|
| 409 | public function getFromContactGroup(int $addressBookId, string $group): Circle { |
|
| 410 | $qb = $this->getCirclesSelectSql(); |
|
| 411 | $this->limitToAddressBookId($qb, $addressBookId); |
|
| 412 | $this->limitToContactGroup($qb, $group); |
|
| 413 | ||
| 414 | $cursor = $qb->execute(); |
|
| 415 | $data = $cursor->fetch(); |
|
| 416 | $cursor->closeCursor(); |
|
| 417 | ||
| 418 | if ($data === false) { |
|
| 419 | throw new CircleDoesNotExistException($this->l10n->t('Circle not found')); |
|
| 420 | } |
|
| 421 | ||
| 422 | return $this->parseCirclesSelectSql($data); |
|
| 423 | } |
|
| 424 | ||
| 425 | } |
|
| 426 | ||
| @@ 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 | /** |
|
| @@ 584-598 (lines=15) @@ | ||
| 581 | * @return Member |
|
| 582 | * @throws MemberDoesNotExistException |
|
| 583 | */ |
|
| 584 | public function getContactMember(string $circleId, string $contactId): Member { |
|
| 585 | $qb = $this->getMembersSelectSql(); |
|
| 586 | $this->limitToContactId($qb, $contactId); |
|
| 587 | $this->limitToCircleId($qb, $circleId); |
|
| 588 | ||
| 589 | $cursor = $qb->execute(); |
|
| 590 | $data = $cursor->fetch(); |
|
| 591 | $cursor->closeCursor(); |
|
| 592 | ||
| 593 | if ($data === false) { |
|
| 594 | throw new MemberDoesNotExistException($this->l10n->t('This member does not exist')); |
|
| 595 | } |
|
| 596 | ||
| 597 | return $this->parseMembersSelectSql($data); |
|
| 598 | } |
|
| 599 | ||
| 600 | ||
| 601 | /** |
|