/**
  * @return static
  */
 public function withProductAttributes()
 {
     foreach ($this->entity->getProductAttributes() as $productAttribute) {
         $this->entityDTO->productAttributes[] = $this->dtoBuilderFactory->getProductAttributeDTOBuilder($productAttribute)->withProduct()->build();
     }
     return $this;
 }
예제 #2
0
 public function testCreate()
 {
     $attribute = $this->dummyData->getAttribute();
     $productAttribute = $this->dummyData->getProductAttribute();
     $attributeValue = new AttributeValue($attribute);
     $attributeValue->setSku('TA');
     $attributeValue->setName('Test Attribute');
     $attributeValue->setDescription('Test attribute description');
     $attributeValue->setSortOrder(0);
     $attributeValue->addProductAttribute($productAttribute);
     $this->assertEntityValid($attributeValue);
     $this->assertSame('TA', $attributeValue->getSku());
     $this->assertSame('Test Attribute', $attributeValue->getName());
     $this->assertSame('Test attribute description', $attributeValue->getDescription());
     $this->assertSame(0, $attributeValue->getSortOrder());
     $this->assertSame($attribute, $attributeValue->getAttribute());
     $this->assertSame($productAttribute, $attributeValue->getProductAttributes()[0]);
 }
예제 #3
0
 public function getAttributeValue(Attribute $attribute = null)
 {
     if ($attribute === null) {
         $attribute = $this->getAttribute();
     }
     $attributeValue = new AttributeValue($attribute);
     $attributeValue->setSku('TAV');
     $attributeValue->setName('Test Attribute Value');
     $attributeValue->setDescription('Test Attribute Value Description');
     $attributeValue->setSortOrder(0);
     return $attributeValue;
 }