Skip to content

Commit 353ef4f

Browse files
authored
Merge pull request #439 from magento-mpi/PR-develop
[MPI] Bugfixes for develop
2 parents 6af7f78 + efff276 commit 353ef4f

File tree

3 files changed

+30
-3
lines changed

3 files changed

+30
-3
lines changed

app/code/Magento/CatalogInventory/Model/Stock/Status.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function getWebsiteId()
100100
*/
101101
public function getStockId()
102102
{
103-
return $this->getData(self::KEY_WEBSITE_ID);
103+
return $this->getData(self::KEY_STOCK_ID);
104104
}
105105

106106
/**

app/code/Magento/Paypal/Model/Config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,7 @@ public function isOrderReviewStepDisabled()
866866
*/
867867
public function getExpressCheckoutStartUrl($token)
868868
{
869-
return sprintf('https://www.%spaypal.com/checkoutnow/2%s',
869+
return sprintf('https://www.%spaypal.com/checkoutnow%s',
870870
$this->getValue('sandboxFlag') ? 'sandbox.' : '',
871871
'?token=' . urlencode($token));
872872
}

app/code/Magento/Vault/Setup/UpgradeData.php

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
*/
66
namespace Magento\Vault\Setup;
77

8+
use Magento\Framework\App\ObjectManager;
9+
use Magento\Framework\App\ResourceConnection;
10+
use Magento\Framework\DB\Adapter\AdapterInterface;
811
use Magento\Framework\Setup\ModuleContextInterface;
912
use Magento\Framework\Setup\ModuleDataSetupInterface;
1013
use Magento\Framework\Setup\UpgradeDataInterface;
@@ -16,13 +19,18 @@
1619
*/
1720
class UpgradeData implements UpgradeDataInterface
1821
{
22+
/**
23+
* @var AdapterInterface
24+
*/
25+
private $connection;
26+
1927
/**
2028
* @inheritdoc
2129
*/
2230
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
2331
{
2432
$setup->startSetup();
25-
$connection = $setup->getConnection();
33+
$connection = $this->getConnection();
2634

2735
// data update for Vault module < 2.0.1
2836
if (version_compare($context->getVersion(), '2.0.1', '<')) {
@@ -59,4 +67,23 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
5967

6068
$setup->endSetup();
6169
}
70+
71+
/**
72+
* Tries to get connection for scalable sales DB, otherwise returns default connection
73+
* @return AdapterInterface
74+
*/
75+
private function getConnection()
76+
{
77+
if ($this->connection === null) {
78+
/** @var ResourceConnection $conn */
79+
$conn = ObjectManager::getInstance()->get(ResourceConnection::class);
80+
try {
81+
$this->connection = $conn->getConnectionByName('sales');
82+
} catch (\DomainException $e) {
83+
$this->connection = $conn->getConnection();
84+
}
85+
}
86+
87+
return $this->connection;
88+
}
6289
}

0 commit comments

Comments
 (0)