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