Skip to content

Instantly share code, notes, and snippets.

@mikedfunk
Last active September 17, 2020 21:26
Show Gist options
  • Save mikedfunk/e81a18b8e06d089d76cd63bf81d6b8da to your computer and use it in GitHub Desktop.
Save mikedfunk/e81a18b8e06d089d76cd63bf81d6b8da to your computer and use it in GitHub Desktop.
<?php
declare(strict_types=1);
namespace SaatchiArt\BentoBoxDDD\Services\UserActions;
use SaatchiArt\BentoBoxDDD\Services\UserActions\SecondaryAdapters\Repositories\UserRepositoryInterface as 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