Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ParentId.php
Go to the documentation of this file.
1 <?php
8 
10 use Magento\Mtf\Fixture\DataSource;
11 use Magento\Mtf\Fixture\FixtureFactory;
12 
16 class ParentId extends DataSource
17 {
23  protected $parentCategory = null;
24 
31  public function __construct(FixtureFactory $fixtureFactory, array $params, $data = [])
32  {
33  $this->params = $params;
34  if (isset($data['dataset']) && $data['dataset'] !== '-') {
35  $this->parentCategory = $fixtureFactory->createByCode('category', ['dataset' => $data['dataset']]);
36  if (!$this->parentCategory->hasData('id')) {
37  $this->parentCategory->persist();
38  }
39  $this->data = $this->parentCategory->getId();
40  } elseif (isset($data['source']) && $data['source'] instanceof Category) {
41  $this->parentCategory = $data['source'];
42  $this->data = $data['source']->getId();
43  } else {
44  $this->data = $data;
45  }
46  }
47 
53  public function getParentCategory()
54  {
55  return $this->parentCategory;
56  }
57 }
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17
__construct(FixtureFactory $fixtureFactory, array $params, $data=[])
Definition: ParentId.php:31
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]
Definition: website.php:18