Created
December 10, 2020 08:55
-
-
Save Vilintritenmert/a6bb2cb956f5f32923c5d50e9e16e3fd to your computer and use it in GitHub Desktop.
Domain Driven Design
This file contains hidden or 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 | |
class Register { | |
/** | |
* @param $repository CustomerRepositoryInterface | |
* @param $history CustomerHistoryInterface | |
**/ | |
public function __constructor( | |
CustomerRepositoryInterface $repository, | |
CustomerHistoryInterface $history | |
) { | |
$this->repository = $repository; | |
$this->history = $history; | |
} | |
/** | |
* @param $customerDTO CustomerDTO | |
* | |
* @return Customer | |
**/ | |
public function handle(CustomerDTO $customerDTO): Customer | |
{ | |
$customer = $this->repository->create($customerDTO); | |
$this->history->registered($customer); | |
return $customer; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment