Skip to content

Commit

Permalink
[BUGFIX] Fix dispatch of DummyUserEvent
Browse files Browse the repository at this point in the history
The event is now dispatched in a way that the result of a potential eventlistener can be used.
  • Loading branch information
BastiLu authored and einpraegsam committed Jul 21, 2023
1 parent 073288c commit 5c1c701
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Classes/Domain/Factory/UserFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ public function getDummyUser(): User
}
ObjectAccess::setProperty($user, 'crdate', new DateTime());
$user->_setProperty('uid', 9999999999999);
$this->eventDispatcher->dispatch(GeneralUtility::makeInstance(DummyUserEvent::class, $user));
return $user;
$dummyUserEvent = GeneralUtility::makeInstance(DummyUserEvent::class, $user);
$this->eventDispatcher->dispatch($dummyUserEvent);
return $dummyUserEvent->getUser();
}
}
10 changes: 10 additions & 0 deletions Classes/Events/DummyUserEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,14 @@ public function getUser(): User
{
return $this->user;
}

/**
* @param User $user
* @return $this
*/
public function setUser(User $user): self
{
$this->user = $user;
return $this;
}
}

0 comments on commit 5c1c701

Please sign in to comment.