Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
framework
Setup
Declaration
Schema
Operations
ModifyTable.php
Go to the documentation of this file.
1
<?php
7
namespace
Magento\Framework\Setup\Declaration\Schema\Operations
;
8
9
use
Magento\Framework\Setup\Declaration\Schema\Db\DbSchemaWriterInterface
;
10
use
Magento\Framework\Setup\Declaration\Schema\Db\DefinitionAggregator
;
11
use
Magento\Framework\Setup\Declaration\Schema\Dto\Column
;
12
use
Magento\Framework\Setup\Declaration\Schema\Dto\Table
;
13
use
Magento\Framework\Setup\Declaration\Schema\ElementHistory
;
14
use
Magento\Framework\Setup\Declaration\Schema\OperationInterface
;
15
21
class
ModifyTable
implements
OperationInterface
22
{
26
const
OPERATION_NAME
=
'modify_table'
;
27
31
private
$dbSchemaWriter;
32
36
public
function
__construct
(
DbSchemaWriterInterface
$dbSchemaWriter)
37
{
38
$this->dbSchemaWriter = $dbSchemaWriter;
39
}
40
44
public
function
getOperationName
()
45
{
46
return
self::OPERATION_NAME
;
47
}
48
52
public
function
isOperationDestructive
()
53
{
54
return
false
;
55
}
56
60
public
function
doOperation
(
ElementHistory
$elementHistory)
61
{
63
$table
= $elementHistory->
getNew
();
65
$oldTable = $elementHistory->
getOld
();
66
$oldOptions
= $oldTable->getDiffSensitiveParams();
67
$statements = [];
68
69
foreach
(
$table
->getDiffSensitiveParams() as $optionName =>
$optionValue
) {
70
if
(
$oldOptions
[$optionName] !==
$optionValue
) {
71
$statements[] = $this->dbSchemaWriter->modifyTableOption(
72
$table
->getName(),
73
$table
->getResource(),
74
$optionName,
75
$optionValue
76
);
77
}
78
}
79
80
return
$statements;
81
}
82
}
Magento\Framework\Setup\Declaration\Schema\Dto\Column
Definition:
Column.php:11
Magento\Framework\Setup\Declaration\Schema\ElementHistory\getNew
getNew()
Definition:
ElementHistory.php:55
Magento\Framework\Setup\Declaration\Schema\Db\DbSchemaWriterInterface
Definition:
DbSchemaWriterInterface.php:13
$oldOptions
$oldOptions
Definition:
product_simple.php:107
Magento\Framework\Setup\Declaration\Schema\Dto\Table
Definition:
Table.php:17
Magento\Framework\Setup\Declaration\Schema\OperationInterface\doOperation
doOperation(ElementHistory $elementHistory)
Magento\Framework\Setup\Declaration\Schema\Operations\ModifyTable
Definition:
ModifyTable.php:21
Magento\Framework\Setup\Declaration\Schema\Operations\ModifyTable\isOperationDestructive
isOperationDestructive()
Definition:
ModifyTable.php:52
Magento\Framework\Setup\Declaration\Schema\ElementHistory
Definition:
ElementHistory.php:16
Magento\Framework\Setup\Declaration\Schema\Operations\ModifyTable\__construct
__construct(DbSchemaWriterInterface $dbSchemaWriter)
Definition:
ModifyTable.php:36
Magento\Framework\Setup\Declaration\Schema\OperationInterface
Definition:
OperationInterface.php:14
Magento\Framework\Setup\Declaration\Schema\Operations
Definition:
AddColumn.php:7
$optionValue
$optionValue
Definition:
quote_with_product_and_custom_options.php:9
Magento\Framework\Setup\Declaration\Schema\Operations\ModifyTable\getOperationName
getOperationName()
Definition:
ModifyTable.php:44
$table
$table
Definition:
trigger.php:14
Magento\Framework\Setup\Declaration\Schema\Operations\ModifyTable\OPERATION_NAME
const OPERATION_NAME
Definition:
ModifyTable.php:26
Magento\Framework\Setup\Declaration\Schema\ElementHistory\getOld
getOld()
Definition:
ElementHistory.php:45
Magento\Framework\Setup\Declaration\Schema\Db\DefinitionAggregator
Definition:
DefinitionAggregator.php:17