Example #1
0
 /**
  * @param AddWishRequest $request
  *
  * @return void
  *
  * @throws UserDoesNotExistException
  */
 public function execute($request = null)
 {
     $userId = $request->userId();
     $address = $request->address();
     $content = $request->content();
     $user = $this->findUserOrFail($userId);
     $wish = $user->makeWish($this->wishRepository->nextIdentity(), $address, $content);
     $this->wishRepository->add($wish);
 }
 /**
  * @param AddWishRequest $request
  *
  * @return mixed|void
  *
  * @throws UserDoesNotExistException
  */
 public function execute($request = null)
 {
     $userId = $request->userId();
     $address = $request->email();
     $content = $request->content();
     $user = $this->userRepository->ofId(new UserId($userId));
     if (null === $user) {
         throw new UserDoesNotExistException();
     }
     $this->wishRepository->add($user->makeWishNotBeingAnAggregate($this->wishRepository->nextIdentity(), $address, $content));
 }
 /**
  * @param AddWishRequest $request
  * @return mixed|void
  * @throws UserDoesNotExistException
  */
 public function execute($request = null)
 {
     $userId = $request->userId();
     $email = $request->email();
     $content = $request->content();
     $user = $this->userRepository->userOfId(new UserId($userId));
     if (null === $user) {
         throw new UserDoesNotExistException();
     }
     $this->wishRepository->persist($user->makeWish($this->wishRepository->nextIdentity(), $email, $content));
 }