public function __construct( UserRepositoryInterface $repository, UserCreateOutputPortInterface $outputPort) { $this->repository = $repository; $this->outputPort = $outputPort; } public function handle(UserCreateInputData $inputData) { $id = uniqid(); $user = new User ( new UserId($id), new UserName($inputData->getName()), $this->getRole($inputData->getRole()) ); $this->repository->save($user); $outputdata = new UserCreateOutputData($id); $this->outputPort->output($outputdata); } ... }
public function __construct( UserRepositoryInterface $repository, UserCreateOutputPortInterface $outputPort) { $this->repository = $repository; $this->outputPort = $outputPort; } public function handle(UserCreateInputData $inputData) { $id = uniqid(); $user = new User ( new UserId($id), new UserName($inputData->getName()), $this->getRole($inputData->getRole()) ); $this->repository->save($user); $outputdata = new UserCreateOutputData($id); $this->outputPort->output($outputdata); } ... }
public function __construct( UserRepositoryInterface $repository, UserCreateOutputPortInterface $outputPort) { $this->repository = $repository; $this->outputPort = $outputPort; } public function handle(UserCreateInputData $inputData) { $id = uniqid(); $user = new User ( new UserId($id), new UserName($inputData->getName()), $this->getRole($inputData->getRole()) ); $this->repository->save($user); $outputdata = new UserCreateOutputData($id); $this->outputPort->output($outputdata); } ... }
public function __construct( UserRepositoryInterface $repository, UserCreateOutputPortInterface $outputPort) { $this->repository = $repository; $this->outputPort = $outputPort; } public function handle(UserCreateInputData $inputData) { $id = uniqid(); $user = new User ( new UserId($id), new UserName($inputData->getName()), $this->getRole($inputData->getRole()) ); $this->repository->save($user); $outputdata = new UserCreateOutputData($id); $this->outputPort->output($outputdata); } ... }
public function __construct( UserId $id, UserName $name, UserRole $role ) { if (is_null($id)) throw new ¥Exception(); if (is_null($name)) throw new ¥Exception(); if (is_null($role)) throw new ¥Exception(); $this->id = $id; $this->name = $name; $this->role = $role; } ... public function changeName(UserName $name) { if (is_null($name)) throw new ¥Exception(); $this->name = $name; } }
public function __construct( UserId $id, UserName $name, UserRole $role ) { if (is_null($id)) throw new ¥Exception(); if (is_null($name)) throw new ¥Exception(); if (is_null($role)) throw new ¥Exception(); $this->id = $id; $this->name = $name; $this->role = $role; } ... public function changeName(UserName $name) { if (is_null($name)) throw new ¥Exception(); $this->name = $name; } } class UserName { private $value; public function __construct(string $value) { if (is_null($value)) throw new ¥Exception(); if (strlen($value) < 3) throw new ¥Exception(); if (strlen($value) > 10) throw new ¥Exception(); $this->value = $value; } public function getValue(): string { return $this->value; } }
public function __construct( UserId $id, UserName $name, UserRole $role ) { if (is_null($id)) throw new ¥Exception(); if (is_null($name)) throw new ¥Exception(); if (is_null($role)) throw new ¥Exception(); $this->id = $id; $this->name = $name; $this->role = $role; } ... public function changeName(UserName $name) { if (is_null($name)) throw new ¥Exception(); $this->name = $name; } } class UserName { private $value; public function __construct(string $value) { if (is_null($value)) throw new ¥Exception(); if (strlen($value) < 3) throw new ¥Exception(); if (strlen($value) > 10) throw new ¥Exception(); $this->value = $value; } public function getValue(): string { return $this->value; } } データモデルとは異なる
$repository; private $outputPort; public function __construct( UserRepositoryInterface $repository, UserCreateOutputPortInterface $outputPort) { $this->repository = $repository; $this->outputPort = $outputPort; } public function handle(UserCreateInputData $inputData) { $id = uniqid(); $user = new User ( new UserId($id), new UserName($inputData->getName()), $this->getRole($inputData->getRole()) ); $this->repository->save($user); $outputdata = new UserCreateOutputData($id); $this->outputPort->output($outputdata); }
private $repository; private $outputPort; public function __construct( UserRepositoryInterface $repository, UserCreateOutputPortInterface $outputPort) { $this->repository = $repository; $this->outputPort = $outputPort; } public function handle(UserCreateInputData $inputData) { $id = uniqid(); $user = new User ( new UserId($id), new UserName($inputData->getName()), $this->getRole($inputData->getRole()) ); $this->repository->save($user); $outputdata = new UserCreateOutputData($id); $this->outputPort->output($outputdata); }
private $repository; private $outputPort; public function __construct( UserRepositoryInterface $repository, UserCreateOutputPortInterface $outputPort) { $this->repository = $repository; $this->outputPort = $outputPort; } public function handle(UserCreateInputData $inputData) { $id = uniqid(); $user = new User ( new UserId($id), new UserName($inputData->getName()), $this->getRole($inputData->getRole()) ); $this->repository->save($user); $outputdata = new UserCreateOutputData($id); $this->outputPort->output($outputdata); }
public function handle(UserCreateInputData $input { $id = uniqid(); $user = new User ( new UserId($id), new UserName($inputData->getName()), $this->getRole($inputData->getRole()) ); $this->repository->save($user); $outputdata = new UserCreateOutputData($id); $this->outputPort->output($outputdata); }
... public function handle(UserCreateInputData $input { $id = uniqid(); $user = new User ( new UserId($id), new UserName($inputData->getName()), $this->getRole($inputData->getRole()) ); $this->repository->save($user); $outputdata = new UserCreateOutputData($id); $this->outputPort->output($outputdata); }
... public function handle(UserCreateInputData $input { $id = uniqid(); $user = new User ( new UserId($id), new UserName($inputData->getName()), $this->getRole($inputData->getRole()) ); $this->repository->save($user); $outputdata = new UserCreateOutputData($id); $this->outputPort->output($outputdata); }