Ejemplo n.º 1
0
 public function __construct(OrderItem $orderItem, DTOBuilderFactoryInterface $dtoBuilderFactory)
 {
     $this->entity = $orderItem;
     $this->dtoBuilderFactory = $dtoBuilderFactory;
     $this->entityDTO = $this->getEntityDTO();
     $this->setId();
     $this->setTime();
     $this->entityDTO->quantity = $this->entity->getQuantity();
     $this->entityDTO->sku = $this->entity->getSku();
     $this->entityDTO->name = $this->entity->getName();
     $this->entityDTO->discountNames = $this->entity->getDiscountNames();
     $this->entityDTO->areAttachmentsEnabled = $this->entity->areAttachmentsEnabled();
     if ($this->entity->getPrice() !== null) {
         $this->entityDTO->price = $this->dtoBuilderFactory->getPriceDTOBuilder($orderItem->getPrice())->withAllData()->build();
     }
     if ($this->entity->getProduct() !== null) {
         $this->entityDTO->shippingWeight = $this->entity->getShippingWeight();
         $this->entityDTO->quantityShippingWeight = $this->entity->getQuantityShippingWeight();
         $this->entityDTO->product = $this->dtoBuilderFactory->getProductDTOBuilder($this->entity->getProduct())->withTags()->build();
     }
 }