Download src/Workspace/Application/CommandHandlers/AcceptInvitationCommandHandler.php from pnacorp/AIKEEDO: direct link, hf CLI and curl.
- Browser
- Download file 876 Bytes
-
https://huggingface.co/pnacorp/AIKEEDO/resolve/main/src/Workspace/Application/CommandHandlers/AcceptInvitationCommandHandler.php
- Command line
-
hf download hf://pnacorp/AIKEEDO/src/Workspace/Application/CommandHandlers/AcceptInvitationCommandHandler.php
-
curl -L -o AcceptInvitationCommandHandler.php https://huggingface.co/pnacorp/AIKEEDO/resolve/main/src/Workspace/Application/CommandHandlers/AcceptInvitationCommandHandler.php
876 Bytes
| declare(strict_types=1); | |
| namespace Workspace\Application\CommandHandlers; | |
| use Workspace\Application\Commands\AcceptInvitationCommand; | |
| use Workspace\Domain\Entities\WorkspaceEntity; | |
| use Workspace\Domain\Exceptions\WorkspaceNotFoundException; | |
| use Workspace\Domain\Exceptions\InvitationNotFoundException; | |
| use Workspace\Domain\Repositories\WorkspaceRepositoryInterface; | |
| class AcceptInvitationCommandHandler | |
| { | |
| public function __construct( | |
| private WorkspaceRepositoryInterface $repo | |
| ) { | |
| } | |
| /** | |
| * @throws WorkspaceNotFoundException | |
| * @throws InvitationNotFoundException | |
| */ | |
| public function handle(AcceptInvitationCommand $cmd): WorkspaceEntity | |
| { | |
| $ws = $this->repo->ofId($cmd->workspaceId); | |
| $ws->acceptInvitation($cmd->id, $cmd->user); | |
| $cmd->user->setCurrentWorkspace($ws); | |
| return $ws; | |
| } | |
| } | |