Пример #1
0
 public function withUser()
 {
     $user = $this->entity->getUser();
     if ($user !== null) {
         $this->entityDTO->user = $this->dtoBuilderFactory->getUserDTOBuilder($user)->build();
     }
     return $this;
 }
Пример #2
0
 public function handle(ListUsersQuery $query)
 {
     $paginationDTO = $query->getRequest()->getPaginationDTO();
     $pagination = new Pagination($paginationDTO->maxResults, $paginationDTO->page);
     $users = $this->userService->getAllUsers($query->getRequest()->getQueryString(), $pagination);
     $query->getResponse()->setPaginationDTOBuilder($this->dtoBuilderFactory->getPaginationDTOBuilder($pagination));
     foreach ($users as $user) {
         $query->getResponse()->addUserDTOBuilder($this->dtoBuilderFactory->getUserDTOBuilder($user));
     }
 }
Пример #3
0
 public function __construct(Cart $cart, DTOBuilderFactoryInterface $dtoBuilderFactory)
 {
     $this->entity = $cart;
     $this->dtoBuilderFactory = $dtoBuilderFactory;
     $this->entityDTO = new CartDTO();
     $this->setId();
     $this->setTime();
     $this->entityDTO->totalItems = $this->entity->totalItems();
     $this->entityDTO->totalQuantity = $this->entity->totalQuantity();
     $this->entityDTO->shippingWeight = $this->entity->getShippingWeight();
     $this->entityDTO->shippingWeightInPounds = $this->entity->getShippingWeightInPounds();
     if ($cart->getShipmentRate() !== null) {
         $this->entityDTO->shipmentRate = $this->dtoBuilderFactory->getShipmentRateDTOBuilder($cart->getShipmentRate())->build();
     }
     if ($cart->getShippingAddress() !== null) {
         $this->entityDTO->shippingAddress = $this->dtoBuilderFactory->getOrderAddressDTOBuilder($cart->getShippingAddress())->build();
     }
     if ($cart->getTaxRate() !== null) {
         $this->entityDTO->taxRate = $this->dtoBuilderFactory->getTaxRateDTOBuilder($cart->getTaxRate())->build();
     }
     if ($cart->getUser() !== null) {
         $this->entityDTO->user = $this->dtoBuilderFactory->getUserDTOBuilder($cart->getUser())->build();
     }
 }
 public function handle(GetUserByEmailQuery $query)
 {
     $product = $this->userService->findOneByEmail($query->getRequest()->getEmail());
     $query->getResponse()->setUserDTOBuilder($this->dtoBuilderFactory->getUserDTOBuilder($product));
 }