Skip to content

Instantly share code, notes, and snippets.

@mikedfunk
Created September 17, 2020 21:43
Show Gist options
  • Save mikedfunk/6665c91bcb7d01c9878d227b7cafbac4 to your computer and use it in GitHub Desktop.
Save mikedfunk/6665c91bcb7d01c9878d227b7cafbac4 to your computer and use it in GitHub Desktop.
<?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