Skip to content

Commit

Permalink
Dispatch 'store_add' event when creating a store to ensure the sequen…
Browse files Browse the repository at this point in the history
…ce tables are created.
  • Loading branch information
paulpartington-cti committed Nov 7, 2016
1 parent ae84632 commit 132bd10
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Model/Component/Websites.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,19 @@ class Websites extends YamlComponentAbstract
protected $description = 'Component to manage Websites, Stores and Store Views';
protected $indexer;
protected $reindex = false;
/**
* @var \Magento\Framework\Event\ManagerInterface
*/
protected $eventManager;

public function __construct(
LoggingInterface $log,
ObjectManagerInterface $objectManager,
\Magento\Indexer\Model\IndexerFactory $indexerFactory
\Magento\Indexer\Model\IndexerFactory $indexerFactory,
\Magento\Framework\Event\ManagerInterface $eventManager
) {
$this->indexer = $indexerFactory;
$this->eventManager = $eventManager;
parent::__construct($log, $objectManager);
}

Expand Down Expand Up @@ -324,6 +330,7 @@ protected function processStoreView($code, $storeViewData, Group $storeGroup)

// Save the store view
$storeView->getResource()->save($storeView);
$this->eventManager->dispatch('store_add', ['store' => $storeView]);
$this->log->logInfo(sprintf("Saved store view '%s'", $code), $logNest);
}
return $storeView;
Expand Down

0 comments on commit 132bd10

Please sign in to comment.