Skip to content

Commit 01a7214

Browse files
committed
MAGETWO-68969: sales_sequence_meta table contents are different depending on whether Magento was upgraded vs installed
- Add UpgradeData instead RecurringData since we need this functionality during install and upgrade flows
1 parent cf9ea5b commit 01a7214

File tree

3 files changed

+80
-7
lines changed

3 files changed

+80
-7
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\SalesSequence\Setup;
7+
8+
use Magento\Framework\Setup\InstallDataInterface;
9+
use Magento\Framework\Setup\ModuleContextInterface;
10+
use Magento\Framework\Setup\ModuleDataSetupInterface;
11+
12+
/**
13+
* Recurring data upgrade for SalesSequence module.
14+
*/
15+
class InstallData implements InstallDataInterface
16+
{
17+
/**
18+
* @var SequenceCreator
19+
*/
20+
private $sequenceCreator;
21+
22+
/**
23+
* @param SequenceCreator $sequenceCreator
24+
*/
25+
public function __construct(
26+
SequenceCreator $sequenceCreator
27+
) {
28+
$this->sequenceCreator = $sequenceCreator;
29+
}
30+
31+
/**
32+
* {@inheritdoc}
33+
*/
34+
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
35+
{
36+
$this->sequenceCreator->create();
37+
}
38+
}

app/code/Magento/SalesSequence/Setup/RecurringData.php renamed to app/code/Magento/SalesSequence/Setup/SequenceCreator.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,14 @@
66

77
namespace Magento\SalesSequence\Setup;
88

9-
use Magento\Framework\Setup\InstallDataInterface;
10-
use Magento\Framework\Setup\ModuleContextInterface;
11-
use Magento\Framework\Setup\ModuleDataSetupInterface;
129
use Magento\SalesSequence\Model\Builder;
1310
use Magento\SalesSequence\Model\Config as SequenceConfig;
1411
use Magento\SalesSequence\Model\EntityPool;
1512

1613
/**
17-
* Recurring data upgrade for SalesSequence module.
14+
* Initial creating sequences.
1815
*/
19-
class RecurringData implements InstallDataInterface
16+
class SequenceCreator
2017
{
2118
/**
2219
* Sales setup factory
@@ -51,9 +48,9 @@ public function __construct(
5148
}
5249

5350
/**
54-
* {@inheritdoc}
51+
* Creates sales sequences.
5552
*/
56-
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
53+
public function create()
5754
{
5855
$defaultStoreIds = [0, 1];
5956
foreach ($defaultStoreIds as $storeId) {
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\SalesSequence\Setup;
7+
8+
use Magento\Framework\Setup\UpgradeDataInterface;
9+
use Magento\Framework\Setup\ModuleContextInterface;
10+
use Magento\Framework\Setup\ModuleDataSetupInterface;
11+
12+
/**
13+
* Recurring data upgrade for SalesSequence module.
14+
*/
15+
class UpgradeData implements UpgradeDataInterface
16+
{
17+
/**
18+
* @var SequenceCreator
19+
*/
20+
private $sequenceCreator;
21+
22+
/**
23+
* @param SequenceCreator $sequenceCreator
24+
*/
25+
public function __construct(
26+
SequenceCreator $sequenceCreator
27+
) {
28+
$this->sequenceCreator = $sequenceCreator;
29+
}
30+
31+
/**
32+
* {@inheritdoc}
33+
*/
34+
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
35+
{
36+
$this->sequenceCreator->create();
37+
}
38+
}

0 commit comments

Comments
 (0)