/** * Get the mini-game corresponding to the id * * @param MiniGameId $id * @throws GameNotFoundException * @return MiniGame */ public function load(MiniGameId $id) { $game = $this->repository->load($id); if ($game !== null && !$game instanceof MiniGame) { throw new \InvalidArgumentException(); } return $game; }
/** * Get the user corresponding to the id * * @param ApplicationUserId $id * * @throws MessageAppException * @return SourcedUser */ public function load(ApplicationUserId $id) { $user = $this->repository->load($id); if ($user !== null && !$user instanceof SourcedUser) { throw new \InvalidArgumentException(); } return $user; }
/** * @param RegistrationRequestId $registrationRequestId * @return RegistrationRequest */ public function load(RegistrationRequestId $registrationRequestId) : RegistrationRequest { return $this->repo->load((string) $registrationRequestId); }
/** * @param MemberId $memberId * @return Member */ public function load(MemberId $memberId) : Member { return $this->repo->load((string) $memberId); }
/** * @param CommitteeId $committeeId * @return Committee */ public function load(CommitteeId $committeeId) : Committee { return $this->repo->load((string) $committeeId); }
/** * @param BookId $BookId * @return Book */ public function load(BookId $BookId) : Book { return $this->repo->load((string) $BookId); }
/** * @param PostId $postId * @return Post */ public function load(PostId $postId) : Post { return $this->repo->load((string) $postId); }
/** * @test * @expectedException \Broadway\Repository\AggregateNotFoundException */ public function it_throws_an_exception_if_aggregate_was_not_found() { $this->repository->load('does-not-exist'); }