public function __construct(Product $product, DTOBuilderFactoryInterface $dtoBuilderFactory)
 {
     $this->entity = $product;
     $this->dtoBuilderFactory = $dtoBuilderFactory;
     $this->initializeProductDTO();
     $this->setId();
     $this->setTime();
     $this->entityDTO->slug = Slug::get($this->entity->getName());
     $this->entityDTO->sku = $this->entity->getSku();
     $this->entityDTO->name = $this->entity->getName();
     $this->entityDTO->unitPrice = $this->entity->getUnitPrice();
     $this->entityDTO->quantity = $this->entity->getQuantity();
     $this->entityDTO->isInventoryRequired = $this->entity->isInventoryRequired();
     $this->entityDTO->isPriceVisible = $this->entity->isPriceVisible();
     $this->entityDTO->isVisible = $this->entity->isVisible();
     $this->entityDTO->isActive = $this->entity->isActive();
     $this->entityDTO->isTaxable = $this->entity->isTaxable();
     $this->entityDTO->isShippable = $this->entity->isShippable();
     $this->entityDTO->shippingWeight = $this->entity->getShippingWeight();
     $this->entityDTO->description = $this->entity->getDescription();
     $this->entityDTO->rating = $this->entity->getRating();
     $this->entityDTO->defaultImage = $this->entity->getDefaultImage();
     $this->entityDTO->isInStock = $this->entity->inStock();
     $this->entityDTO->areAttachmentsEnabled = $this->entity->areAttachmentsEnabled();
 }
Example #2
0
 public function testStringOrNull()
 {
     $product = new Product();
     $product->setSku('');
     $product->setDescription('');
     $product->setDefaultImage('');
     $this->assertSame(null, $product->getSku());
     $this->assertSame(null, $product->getDescription());
     $this->assertSame(null, $product->getDefaultImage());
 }
Example #3
0
 private function getFullSku()
 {
     $fullSku = [];
     if ($this->product !== null) {
         $sku = $this->product->getSku();
         if ($sku !== null) {
             $fullSku[] = $sku;
         }
     }
     foreach ($this->getOrderItemOptionProducts() as $orderItemOptionProduct) {
         $sku = $orderItemOptionProduct->getSku();
         if ($sku !== null) {
             $fullSku[] = $sku;
         }
     }
     foreach ($this->getOrderItemOptionValues() as $orderItemOptionValue) {
         $sku = $orderItemOptionValue->getSku();
         if ($sku !== null) {
             $fullSku[] = $sku;
         }
     }
     return implode('-', $fullSku);
 }
Example #4
0
 public function getSku()
 {
     return $this->product->getSku();
 }