| @@ 190-214 (lines=25) @@ | ||
| 187 | return $updatedRoleDraft; |
|
| 188 | } |
|
| 189 | ||
| 190 | public function updatePolicyByRoleDraft( |
|
| 191 | RoleDraft $roleDraft, |
|
| 192 | PolicyDraft $policy, |
|
| 193 | PolicyUpdateStruct $policyUpdateStruct |
|
| 194 | ) { |
|
| 195 | $eventData = [ |
|
| 196 | $roleDraft, |
|
| 197 | $policy, |
|
| 198 | $policyUpdateStruct, |
|
| 199 | ]; |
|
| 200 | ||
| 201 | $beforeEvent = new BeforeUpdatePolicyByRoleDraftEvent(...$eventData); |
|
| 202 | if ($this->eventDispatcher->dispatch(RoleEvents::BEFORE_UPDATE_POLICY_BY_ROLE_DRAFT, $beforeEvent)->isPropagationStopped()) { |
|
| 203 | return $beforeEvent->getReturnValue(); |
|
| 204 | } else { |
|
| 205 | $updatedPolicyDraft = parent::updatePolicyByRoleDraft($roleDraft, $policy, $policyUpdateStruct); |
|
| 206 | } |
|
| 207 | ||
| 208 | $this->eventDispatcher->dispatch( |
|
| 209 | RoleEvents::UPDATE_POLICY_BY_ROLE_DRAFT, |
|
| 210 | new UpdatePolicyByRoleDraftEvent($updatedPolicyDraft, ...$eventData) |
|
| 211 | ); |
|
| 212 | ||
| 213 | return $updatedPolicyDraft; |
|
| 214 | } |
|
| 215 | ||
| 216 | public function deleteRoleDraft(RoleDraft $roleDraft): void |
|
| 217 | { |
|
| @@ 39-63 (lines=25) @@ | ||
| 36 | $this->eventDispatcher = $eventDispatcher; |
|
| 37 | } |
|
| 38 | ||
| 39 | public function create( |
|
| 40 | $sourceUrl, |
|
| 41 | $destinationUrl, |
|
| 42 | $forward = false |
|
| 43 | ) { |
|
| 44 | $eventData = [ |
|
| 45 | $sourceUrl, |
|
| 46 | $destinationUrl, |
|
| 47 | $forward, |
|
| 48 | ]; |
|
| 49 | ||
| 50 | $beforeEvent = new BeforeCreateEvent(...$eventData); |
|
| 51 | if ($this->eventDispatcher->dispatch(URLWildcardEvents::BEFORE_CREATE, $beforeEvent)->isPropagationStopped()) { |
|
| 52 | return $beforeEvent->getReturnValue(); |
|
| 53 | } else { |
|
| 54 | $urlWildcard = parent::create($sourceUrl, $destinationUrl, $forward); |
|
| 55 | } |
|
| 56 | ||
| 57 | $this->eventDispatcher->dispatch( |
|
| 58 | URLWildcardEvents::CREATE, |
|
| 59 | new CreateEvent($urlWildcard, ...$eventData) |
|
| 60 | ); |
|
| 61 | ||
| 62 | return $urlWildcard; |
|
| 63 | } |
|
| 64 | ||
| 65 | public function remove(URLWildcard $urlWildcard) |
|
| 66 | { |
|