Created
August 7, 2021 15:40
-
-
Save dgafka/81c7e4590804823d98a34dbab196e5a3 to your computer and use it in GitHub Desktop.
handlings-events-php-03
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Ecotone\Modelling\EventBus; | |
class PersonRegistrationService | |
{ | |
public function __construct(private UserRepository $userRepository, private EventBus $event) {} | |
public function registerUser($registerPersonData) | |
{ | |
$person = new Person($registerPersonData); | |
$this->userRepository->save($person); | |
$this->event->publish(new PersonWasRegistered($person->getPersonId())); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment