Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AttributeSetId.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Mtf\Fixture\DataSource;
10 use Magento\Mtf\Fixture\FixtureFactory;
12 
20 class AttributeSetId extends DataSource
21 {
27  protected $attributeSet;
28 
35  public function __construct(FixtureFactory $fixtureFactory, array $params, $data = [])
36  {
37  $this->params = $params;
38  if (isset($data['dataset']) && $data['dataset'] !== 'Default') {
40  $attributeSet = $fixtureFactory->createByCode('catalogAttributeSet', ['dataset' => $data['dataset']]);
41  if (!$attributeSet->hasData('attribute_set_id')) {
42  $attributeSet->persist();
43  }
44  }
45  if (isset($data['attribute_set']) && $data['attribute_set'] instanceof CatalogAttributeSet) {
46  $attributeSet = $data['attribute_set'];
47  }
48  if (!isset($data['dataset']) && !isset($data['attribute_set'])) {
49  $this->data = $data;
50  } else {
52  $this->data = $attributeSet->getAttributeSetName();
53  $this->attributeSet = $attributeSet;
54  }
55  }
56 
62  public function getAttributeSet()
63  {
64  return $this->attributeSet;
65  }
66 }
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]
Definition: website.php:18