-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MAG-735: Migrate setup scripts to db_schema.xml
- Loading branch information
1 parent
c5d48bf
commit 9fb0225
Showing
5 changed files
with
134 additions
and
135 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<?php | ||
|
||
namespace Signifyd\Connect\Setup\Patch\Data; | ||
|
||
use Magento\Framework\App\Config\Storage\WriterInterface; | ||
use Magento\Framework\Setup\SchemaSetupInterface; | ||
use Magento\Framework\Setup\Patch\DataPatchInterface; | ||
use Signifyd\Connect\Logger\Install; | ||
|
||
class UpdateOrderId implements DataPatchInterface | ||
{ | ||
/** | ||
* @var SchemaSetupInterface | ||
*/ | ||
protected $schemaSetupInterface; | ||
|
||
/** | ||
* @var Install | ||
*/ | ||
protected $logger; | ||
|
||
/** | ||
* @var WriterInterface | ||
*/ | ||
protected $configWriter; | ||
|
||
/** | ||
* @param SchemaSetupInterface $schemaSetupInterface | ||
* @param Install $logger | ||
* @param WriterInterface $configWriter | ||
*/ | ||
public function __construct( | ||
SchemaSetupInterface $schemaSetupInterface, | ||
Install $logger, | ||
WriterInterface $configWriter | ||
) { | ||
$this->schemaSetupInterface = $schemaSetupInterface; | ||
$this->logger = $logger; | ||
$this->configWriter = $configWriter; | ||
} | ||
|
||
public function apply() | ||
{ | ||
$signifydConnectCase = $this->schemaSetupInterface->getTable('signifyd_connect_case'); | ||
$salesOrder = $this->schemaSetupInterface->getTable('sales_order'); | ||
|
||
try { | ||
$this->schemaSetupInterface->getConnection()->query("UPDATE ". $signifydConnectCase ." JOIN " . $salesOrder . " ON " . | ||
$signifydConnectCase .".order_increment = " . $salesOrder . ".increment_id SET " . | ||
$signifydConnectCase .".order_id = " . $salesOrder . ".entity_id WHERE " . | ||
$signifydConnectCase . ".magento_status='complete'"); | ||
} catch (\Exception $e) { | ||
$this->logger->debug('Update order_id on magento status complete failed'); | ||
$this->configWriter->save("signifyd/general/upgrade4.3_inconsistency", "setup"); | ||
} | ||
|
||
try { | ||
$this->schemaSetupInterface->getConnection()->query("UPDATE ". $signifydConnectCase ." JOIN " . $salesOrder . " ON " . | ||
$signifydConnectCase .".order_increment = " . $salesOrder . ".increment_id SET ". | ||
$signifydConnectCase .".order_id = " . $salesOrder . ".entity_id WHERE ". | ||
$signifydConnectCase . ".magento_status<>'complete'"); | ||
} catch (\Exception $e) { | ||
$this->logger->debug('Update order_id on magento status different from complete failed'); | ||
$this->configWriter->save("signifyd/general/upgrade4.3_inconsistency", "setup"); | ||
} | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getAliases() | ||
{ | ||
return []; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public static function getDependencies() | ||
{ | ||
return [ | ||
|
||
]; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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