| @@ 64-100 (lines=37) @@ | ||
| 61 | return $result; |
|
| 62 | } |
|
| 63 | ||
| 64 | private function owner($organizationId, $ownerId) |
|
| 65 | { |
|
| 66 | try { |
|
| 67 | $this->queryBus->handle( |
|
| 68 | new OwnerOfIdQuery( |
|
| 69 | $organizationId, |
|
| 70 | $ownerId, |
|
| 71 | $this->currentUser |
|
| 72 | ), |
|
| 73 | $result |
|
| 74 | ); |
|
| 75 | ||
| 76 | return $result; |
|
| 77 | } catch (OrganizationDoesNotExistException $exception) { |
|
| 78 | throw new UserError( |
|
| 79 | sprintf( |
|
| 80 | 'Does no exist any organization with the given "%s" id', |
|
| 81 | $organizationId |
|
| 82 | ) |
|
| 83 | ); |
|
| 84 | } catch (UnauthorizedOrganizationActionException $exception) { |
|
| 85 | throw new UserError( |
|
| 86 | sprintf( |
|
| 87 | 'The "%s" user does not allow to access the "%s" organization', |
|
| 88 | $this->currentUser, |
|
| 89 | $organizationId |
|
| 90 | ) |
|
| 91 | ); |
|
| 92 | } catch (OwnerDoesNotExistException $exception) { |
|
| 93 | throw new UserError( |
|
| 94 | sprintf( |
|
| 95 | 'Does no exist any owner with the given "%s" id', |
|
| 96 | $ownerId |
|
| 97 | ) |
|
| 98 | ); |
|
| 99 | } |
|
| 100 | } |
|
| 101 | ||
| 102 | private function organizationMember($organizationId, $organizationMemberId) |
|
| 103 | { |
|
| @@ 102-138 (lines=37) @@ | ||
| 99 | } |
|
| 100 | } |
|
| 101 | ||
| 102 | private function organizationMember($organizationId, $organizationMemberId) |
|
| 103 | { |
|
| 104 | try { |
|
| 105 | $this->queryBus->handle( |
|
| 106 | new OrganizationMemberOfIdQuery( |
|
| 107 | $organizationId, |
|
| 108 | $organizationMemberId, |
|
| 109 | $this->currentUser |
|
| 110 | ), |
|
| 111 | $result |
|
| 112 | ); |
|
| 113 | ||
| 114 | return $result; |
|
| 115 | } catch (OrganizationDoesNotExistException $exception) { |
|
| 116 | throw new UserError( |
|
| 117 | sprintf( |
|
| 118 | 'Does no exist any organization with the given "%s" id', |
|
| 119 | $organizationId |
|
| 120 | ) |
|
| 121 | ); |
|
| 122 | } catch (UnauthorizedOrganizationActionException $exception) { |
|
| 123 | throw new UserError( |
|
| 124 | sprintf( |
|
| 125 | 'The "%s" user does not allow to access the "%s" organization', |
|
| 126 | $this->currentUser, |
|
| 127 | $organizationId |
|
| 128 | ) |
|
| 129 | ); |
|
| 130 | } catch (OrganizationMemberDoesNotExistException $exception) { |
|
| 131 | throw new UserError( |
|
| 132 | sprintf( |
|
| 133 | 'Does no exist any organization member with the given "%s" id', |
|
| 134 | $organizationMemberId |
|
| 135 | ) |
|
| 136 | ); |
|
| 137 | } |
|
| 138 | } |
|
| 139 | } |
|
| 140 | ||