Skip to content

Commit

Permalink
Merge pull request magento#9 from magento-nord/NORD-PR
Browse files Browse the repository at this point in the history
Bugs fixed:
* MAGETWO-59649: Current store resolver does not work for global scope
  • Loading branch information
magicbunneh committed Dec 16, 2016
2 parents f67d399 + f67d522 commit 476ccf6
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 7 deletions.
16 changes: 14 additions & 2 deletions app/code/Magento/GiftCardSampleData/Setup/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
namespace Magento\GiftCardSampleData\Setup;

use Magento\Framework\Setup;
use Magento\Store\Model\StoreManagerInterface;
use Magento\Store\Model\Store;

class Installer implements Setup\SampleData\InstallerInterface
{
Expand Down Expand Up @@ -40,32 +42,42 @@ class Installer implements Setup\SampleData\InstallerInterface
*/
private $css;

/**
* @var StoreManagerInterface
*/
private $storeManager;

/**
* @param \Magento\CatalogSampleData\Model\Category $categorySetup
* @param \Magento\CatalogSampleData\Model\Attribute $attributeSetup
* @param \Magento\GiftCardSampleData\Model\Product $product
* @param \Magento\ProductLinksSampleData\Model\ProductLink $productLinkSetup
* @param \Magento\ThemeSampleData\Model\Css $css
* @param StoreManagerInterface $storeManager
*/
public function __construct(
\Magento\CatalogSampleData\Model\Category $categorySetup,
\Magento\CatalogSampleData\Model\Attribute $attributeSetup,
\Magento\GiftCardSampleData\Model\Product $product,
\Magento\ProductLinksSampleData\Model\ProductLink $productLinkSetup,
\Magento\ThemeSampleData\Model\Css $css
\Magento\ThemeSampleData\Model\Css $css,
StoreManagerInterface $storeManager = null
) {
$this->product = $product;
$this->attributeSetup = $attributeSetup;
$this->categorySetup = $categorySetup;
$this->productLinkSetup = $productLinkSetup;
$this->css = $css;
$this->storeManager = $storeManager ?: \Magento\Framework\App\ObjectManager::getInstance()
->get(StoreManagerInterface::class);
}

/**
* {@inheritdoc}
*/
public function install()
{
$this->storeManager->setCurrentStore(Store::DISTRO_STORE_ID);
$this->attributeSetup->install(['Magento_GiftCardSampleData::fixtures/attributes.csv']);
$this->categorySetup->install(['Magento_GiftCardSampleData::fixtures/categories.csv']);
$this->product->install(
Expand All @@ -79,4 +91,4 @@ public function install()
);
$this->css->install(['Magento_GiftCardSampleData::fixtures/styles.css' => 'styles.css']);
}
}
}
3 changes: 2 additions & 1 deletion app/code/Magento/GiftCardSampleData/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"magento/module-sample-data": "100.2.*",
"magento/module-catalog-sample-data": "100.2.*",
"magento/module-product-links-sample-data": "100.2.*",
"magento/module-theme-sample-data": "100.2.*"
"magento/module-theme-sample-data": "100.2.*",
"magento/module-store": "100.2.*"
},
"type": "magento2-module",
"version": "100.2.0-dev",
Expand Down
19 changes: 16 additions & 3 deletions app/code/Magento/GiftRegistrySampleData/Setup/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
namespace Magento\GiftRegistrySampleData\Setup;

use Magento\Framework\Setup;
use Magento\Store\Model\StoreManagerInterface;
use Magento\Store\Model\Store;

class Installer implements Setup\SampleData\InstallerInterface
{
Expand All @@ -14,19 +16,30 @@ class Installer implements Setup\SampleData\InstallerInterface
*/
protected $giftRegistry;

/**
* @var StoreManagerInterface
*/
private $storeManager;

/**
* @param \Magento\GiftRegistrySampleData\Model\GiftRegistry $giftRegistry
* @param StoreManagerInterface $storeManager
*/
public function __construct(\Magento\GiftRegistrySampleData\Model\GiftRegistry $giftRegistry)
{
public function __construct(
\Magento\GiftRegistrySampleData\Model\GiftRegistry $giftRegistry,
StoreManagerInterface $storeManager = null
) {
$this->giftRegistry = $giftRegistry;
$this->storeManager = $storeManager ?: \Magento\Framework\App\ObjectManager::getInstance()
->get(StoreManagerInterface::class);
}

/**
* {@inheritdoc}
*/
public function install()
{
$this->storeManager->setCurrentStore(Store::DISTRO_STORE_ID);
$this->giftRegistry->install(['Magento_GiftRegistrySampleData::fixtures/gift_registry.csv']);
}
}
}
3 changes: 2 additions & 1 deletion app/code/Magento/GiftRegistrySampleData/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"php": "~5.6.5|7.0.2|7.0.4|~7.0.6",
"magento/module-sample-data": "100.2.*",
"magento/module-gift-registry": "100.2.*",
"magento/module-directory": "100.2.*"
"magento/module-directory": "100.2.*",
"magento/module-store": "100.2.*"
},
"type": "magento2-module",
"version": "100.2.0-dev",
Expand Down

0 comments on commit 476ccf6

Please sign in to comment.