| @@ 40-59 (lines=20) @@ | ||
| 37 | * |
|
| 38 | * @return Palladium\Entity\Identity |
|
| 39 | */ |
|
| 40 | public function findIdentityById($identityId) |
|
| 41 | { |
|
| 42 | $identity = new Entity\Identity; |
|
| 43 | $identity->setId($identityId); |
|
| 44 | ||
| 45 | $mapper = $this->mapperFactory->create(Mapper\Identity::class); |
|
| 46 | $mapper->fetch($identity); |
|
| 47 | ||
| 48 | if ($identity->getAccountId() === null) { |
|
| 49 | $this->logger->warning('identity not found', [ |
|
| 50 | 'input' => [ |
|
| 51 | 'id' => $identityId, |
|
| 52 | ], |
|
| 53 | ]); |
|
| 54 | ||
| 55 | throw new IdentityNotFound; |
|
| 56 | } |
|
| 57 | ||
| 58 | return $identity; |
|
| 59 | } |
|
| 60 | ||
| 61 | ||
| 62 | /** |
|
| @@ 69-88 (lines=20) @@ | ||
| 66 | * |
|
| 67 | * @return Palladium\Entity\EmailIdentity |
|
| 68 | */ |
|
| 69 | public function findEmailIdentityByEmailAddress(string $emailAddress) |
|
| 70 | { |
|
| 71 | $identity = new Entity\EmailIdentity; |
|
| 72 | $identity->setIdentifier($emailAddress); |
|
| 73 | ||
| 74 | $mapper = $this->mapperFactory->create(Mapper\EmailIdentity::class); |
|
| 75 | $mapper->fetch($identity); |
|
| 76 | ||
| 77 | if ($identity->getId() === null) { |
|
| 78 | $this->logger->warning('identity not found', [ |
|
| 79 | 'input' => [ |
|
| 80 | 'identifier' => $emailAddress, |
|
| 81 | ], |
|
| 82 | ]); |
|
| 83 | ||
| 84 | throw new IdentityNotFound; |
|
| 85 | } |
|
| 86 | ||
| 87 | return $identity; |
|
| 88 | } |
|
| 89 | ||
| 90 | ||
| 91 | /** |
|