Created
September 17, 2020 21:43
-
-
Save mikedfunk/6665c91bcb7d01c9878d227b7cafbac4 to your computer and use it in GitHub Desktop.
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 | |
declare(strict_types=1); | |
namespace SaatchiArt\BentoBoxDDD\Domain\Users; | |
use SaatchiArt\BentoBoxDDD\Domain\Artworks\ArtworkService; | |
use SaatchiArt\BentoBoxDDD\SecondaryAdapters\Repositories\UserRepository; | |
final class UserService | |
{ | |
/** @var UserRepository */ | |
private $userRepository; | |
/** @var ArtworkService */ | |
private $artworkService; | |
public function __construct( | |
UserRepository $userRepository, | |
ArtworkService $artworkService | |
) { | |
$this->userRepository = $userRepository; | |
$this->artworkService = $artworkService; | |
} | |
public function goOnVacation(int $userId): void | |
{ | |
$user = $this->userRepository->findByUserId($userId); | |
$user->goOnVacation(); | |
$this->userRepository->storeUser($user); | |
$this->artworkService->makeNotForSaleByUserId($userId); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment