Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
WidgetInstance.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Mtf\Fixture\FixtureFactory;
10 use Magento\Mtf\Fixture\DataSource;
11 use Magento\Mtf\Repository\RepositoryFactory;
12 
16 class WidgetInstance extends DataSource
17 {
25  public function __construct(
26  RepositoryFactory $repositoryFactory,
27  FixtureFactory $fixtureFactory,
28  array $params,
29  array $data = []
30  ) {
31  $this->params = $params;
32 
33  if (isset($data['dataset']) && isset($this->params['repository'])) {
34  $this->data = $repositoryFactory->get($this->params['repository'])->get($data['dataset']);
35  foreach ($this->data as $index => $layouts) {
36  if (isset($layouts['entities'])) {
37  $explodeValue = explode('::', $layouts['entities']);
38  $fixture = $fixtureFactory->createByCode($explodeValue[0], ['dataset' => $explodeValue[1]]);
39  $fixture->persist();
40  $this->data[$index]['entities'] = $fixture;
41  }
42  }
43  } else {
44  $this->data = $data;
45  }
46  }
47 }
__construct(RepositoryFactory $repositoryFactory, FixtureFactory $fixtureFactory, array $params, array $data=[])
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]
Definition: website.php:18
$index
Definition: list.phtml:44