本文整理匯總了PHP中Magento\Catalog\Test\Fixture\Category::getData方法的典型用法代碼示例。如果您正苦於以下問題:PHP Category::getData方法的具體用法?PHP Category::getData怎麽用?PHP Category::getData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Magento\Catalog\Test\Fixture\Category
的用法示例。
在下文中一共展示了Category::getData方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: prepareCategory
/**
* Prepare Category fixture with the updated data.
*
* @param Category $category
* @param Category $initialCategory
* @return Category
*/
protected function prepareCategory(Category $category, Category $initialCategory)
{
$parentCategory = $category->hasData('parent_id') ? $category->getDataFieldConfig('parent_id')['source']->getParentCategory() : $initialCategory->getDataFieldConfig('parent_id')['source']->getParentCategory();
$data = ['data' => array_merge($initialCategory->getData(), $category->getData(), ['parent_id' => ['source' => $parentCategory]])];
return $this->fixtureFactory->createByCode('category', $data);
}
示例2: prepareData
/**
* @param FixtureFactory $fixtureFactory
* @param Category $category
* @param Category $initialCategory
* @return array
*/
protected function prepareData(FixtureFactory $fixtureFactory, Category $category, Category $initialCategory)
{
$product = $fixtureFactory->createByCode('catalogProductSimple', ['dataset' => 'default', 'data' => ['category_ids' => ['category' => $initialCategory]]]);
$product->persist();
return array_merge($initialCategory->getData(), $category->getData());
}