/** * @param CreateOrderFromCartCommand $command * @throws EntityValidatorException */ public function handle(CreateOrderFromCartCommand $command) { $cart = $this->cartService->findOneById($command->getCartId()); $user = $this->userService->findOneById($command->getUserId()); $order = $this->orderService->createOrderFromCart($command->getOrderId(), $user, $cart, $this->cartCalculator, $command->getIp4(), OrderAddressDTOBuilder::createFromDTO($command->getShippingAddressDTO()), OrderAddressDTOBuilder::createFromDTO($command->getBillingAddressDTO()), CreditCardDTOBuilder::createFromDTO($command->getCreditCardDTO())); $this->cartService->delete($cart); }
/** * @param UploadFileDTO $uploadFileDTO * @param UuidInterface $userId * @param UuidInterface $productId * @return void */ public function createAttachmentForUserProduct(UploadFileDTO $uploadFileDTO, UuidInterface $userId, UuidInterface $productId) { $user = $this->userService->findOneById($userId); $product = $this->productService->findOneById($productId); $attachment = $this->createAttachment($uploadFileDTO); $userProductAttachment = new UserProductAttachment($user, $product, $attachment); $this->attachmentRepository->create($userProductAttachment); }
public function handle(GetUserQuery $query) { $product = $this->userService->findOneById($query->getRequest()->getUserId()); $query->getResponse()->setUserDTOBuilder($this->dtoBuilderFactory->getUserDTOBuilder($product)); }