-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5ff3531
commit 18853de
Showing
9 changed files
with
122 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\CatalogSampleDataVenia\Setup\Patch\Data; | ||
|
||
use Magento\Framework\Setup\Patch\DataPatchInterface; | ||
use Magento\Framework\Setup\ModuleDataSetupInterface; | ||
use Magento\CatalogSampleDataVenia\Setup\Category; | ||
use Magento\CatalogSampleDataVenia\Setup\Attribute; | ||
use Magento\CatalogSampleDataVenia\Setup\Product; | ||
use Magento\Framework\Setup\Patch\PatchVersionInterface; | ||
|
||
/** | ||
* Patch is mechanism, that allows to do atomic upgrade data changes | ||
*/ | ||
class InstallSimpleProducts implements | ||
DataPatchInterface, PatchVersionInterface | ||
{ | ||
/** | ||
* Setup class for category | ||
* | ||
* @var \Magento\CatalogSampleDataVenia\Setup\Category | ||
*/ | ||
protected $categorySetup; | ||
|
||
/** | ||
* Setup class for product attributes | ||
* | ||
* @var \Magento\CatalogSampleDataVenia\Setup\Attribute | ||
*/ | ||
protected $attributeSetup; | ||
|
||
/** | ||
* Setup class for products | ||
* | ||
* @var \Magento\CatalogSampleDataVenia\Setup\Product | ||
*/ | ||
protected $productSetup; | ||
|
||
|
||
/** | ||
* @var ModuleDataSetupInterface $moduleDataSetup | ||
*/ | ||
private $moduleDataSetup; | ||
|
||
/** | ||
* InstallSimpleProducts constructor. | ||
* @param ModuleDataSetupInterface $moduleDataSetup | ||
* @param Category $categorySetup | ||
* @param Attribute $attributeSetup | ||
* @param Product $productSetup | ||
*/ | ||
public function __construct(ModuleDataSetupInterface $moduleDataSetup, Category $categorySetup, | ||
Attribute $attributeSetup, Product $productSetup) | ||
{ | ||
$this->moduleDataSetup = $moduleDataSetup; | ||
$this->categorySetup = $categorySetup; | ||
$this->attributeSetup = $attributeSetup; | ||
$this->productSetup = $productSetup; | ||
} | ||
|
||
/** | ||
* Do Upgrade | ||
* | ||
* @return void | ||
*/ | ||
public function apply() | ||
{ | ||
$this->attributeSetup->install(['Magento_CatalogSampleDataVenia::fixtures/attributes.csv']); | ||
$this->categorySetup->install(['Magento_CatalogSampleDataVenia::fixtures/categories.csv']); | ||
$this->productSetup->install( | ||
[ | ||
'Magento_CatalogSampleDataVenia::fixtures/SimpleProduct/products_accessories.csv' | ||
], | ||
[ | ||
'Magento_CatalogSampleDataVenia::fixtures/SimpleProduct/images_accessories.csv' | ||
] | ||
); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getAliases() | ||
{ | ||
return []; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public static function getDependencies() | ||
{ | ||
return [ | ||
|
||
]; | ||
} | ||
public static function getVersion(){ | ||
return '0.0.0'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters