Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions
SimpleProductTemplateGenerator Class Reference
Inheritance diagram for SimpleProductTemplateGenerator:
TemplateEntityGeneratorInterface

Public Member Functions

 __construct (ProductFactory $productFactory, array $fixture)
 
 generateEntity ()
 

Detailed Description

Simple product template generator. Return newly created simple product for specified attribute set with default values for product attributes

Definition at line 19 of file SimpleProductTemplateGenerator.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( ProductFactory  $productFactory,
array  $fixture 
)
Parameters
ProductFactory$productFactory
array$fixture

Definition at line 35 of file SimpleProductTemplateGenerator.php.

36  {
37  $this->fixture = $fixture;
38  $this->productFactory = $productFactory;
39  }

Member Function Documentation

◆ generateEntity()

generateEntity ( )

{

Returns
\Magento\Framework\Model\AbstractModel
}

Implements TemplateEntityGeneratorInterface.

Definition at line 44 of file SimpleProductTemplateGenerator.php.

45  {
46  $attributeSet = $this->fixture['attribute_set_id'];
47  $product = $this->getProductTemplate(
49  $this->fixture['additional_attributes']($attributeSet, 0, 0)
50  );
51  $product->save();
52 
53  return $product;
54  }

The documentation for this class was generated from the following file: