-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #14958 - remove sales sequence data on store view delete
- Loading branch information
1 parent
07e57ac
commit 8529467
Showing
5 changed files
with
136 additions
and
1 deletion.
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 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
44 changes: 44 additions & 0 deletions
44
app/code/Magento/SalesSequence/Observer/SequenceRemovalObserver.php
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,44 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
namespace Magento\SalesSequence\Observer; | ||
|
||
use Magento\Framework\Event\ObserverInterface; | ||
use Magento\Framework\Event\Observer as EventObserver; | ||
use Magento\SalesSequence\Model\Builder; | ||
|
||
/** | ||
* Class SequenceRemovalObserver | ||
*/ | ||
class SequenceRemovalObserver implements ObserverInterface | ||
{ | ||
/** | ||
* @var Builder | ||
*/ | ||
private $sequenceBuilder; | ||
|
||
/** | ||
* @param Builder $sequenceBuilder | ||
*/ | ||
public function __construct( | ||
Builder $sequenceBuilder | ||
) { | ||
$this->sequenceBuilder = $sequenceBuilder; | ||
} | ||
|
||
/** | ||
* @param EventObserver $observer | ||
* @return $this | ||
* @throws \Magento\Framework\Exception\LocalizedException | ||
*/ | ||
public function execute(EventObserver $observer) | ||
{ | ||
$storeId = $observer->getData('store')->getId(); | ||
$this->sequenceBuilder->deleteByStoreId($storeId); | ||
|
||
return $this; | ||
} | ||
} |
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,12 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd"> | ||
<event name="store_delete"> | ||
<observer name="magento_sequence" instance="Magento\SalesSequence\Observer\SequenceRemovalObserver" /> | ||
</event> | ||
</config> |