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
AddComplexElement.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\ElementInterface
;
12
use
Magento\Framework\Setup\Declaration\Schema\Dto\TableElementInterface
;
13
use
Magento\Framework\Setup\Declaration\Schema\ElementHistory
;
14
use
Magento\Framework\Setup\Declaration\Schema\OperationInterface
;
15
21
class
AddComplexElement
implements
OperationInterface
22
{
26
const
OPERATION_NAME
=
'add_complex_element'
;
27
31
private
$definitionAggregator;
32
36
private
$dbSchemaWriter;
37
44
public
function
__construct
(
45
DefinitionAggregator
$definitionAggregator,
46
DbSchemaWriterInterface
$dbSchemaWriter
47
) {
48
$this->definitionAggregator = $definitionAggregator;
49
$this->dbSchemaWriter = $dbSchemaWriter;
50
}
51
55
public
function
getOperationName
()
56
{
57
return
self::OPERATION_NAME
;
58
}
59
63
public
function
isOperationDestructive
()
64
{
65
return
false
;
66
}
67
71
public
function
doOperation
(
ElementHistory
$elementHistory)
72
{
76
$element
= $elementHistory->
getNew
();
77
$definition = $this->definitionAggregator->toDefinition(
$element
);
78
79
$statement = $this->dbSchemaWriter->addElement(
80
$element
->getName(),
81
$element
->getTable()->getResource(),
82
$element
->getTable()->getName(),
83
$definition,
84
$element
->getType()
85
);
86
return
[$statement];
87
}
88
}
Magento\Framework\Setup\Declaration\Schema\Operations\AddComplexElement\__construct
__construct(DefinitionAggregator $definitionAggregator, DbSchemaWriterInterface $dbSchemaWriter)
Definition:
AddComplexElement.php:44
Magento\Framework\Setup\Declaration\Schema\ElementHistory\getNew
getNew()
Definition:
ElementHistory.php:55
Magento\Framework\Setup\Declaration\Schema\Db\DbSchemaWriterInterface
Definition:
DbSchemaWriterInterface.php:13
Magento\Framework\Setup\Declaration\Schema\OperationInterface\doOperation
doOperation(ElementHistory $elementHistory)
Magento\Framework\Setup\Declaration\Schema\Operations\AddComplexElement
Definition:
AddComplexElement.php:21
Magento\Framework\Setup\Declaration\Schema\Operations\AddComplexElement\OPERATION_NAME
const OPERATION_NAME
Definition:
AddComplexElement.php:26
Magento\Framework\Setup\Declaration\Schema\Operations\AddComplexElement\getOperationName
getOperationName()
Definition:
AddComplexElement.php:55
Magento\Framework\Setup\Declaration\Schema\ElementHistory
Definition:
ElementHistory.php:16
Magento\Framework\Setup\Declaration\Schema\Operations\AddComplexElement\isOperationDestructive
isOperationDestructive()
Definition:
AddComplexElement.php:63
Magento\Framework\Setup\Declaration\Schema\OperationInterface
Definition:
OperationInterface.php:14
Magento\Framework\Setup\Declaration\Schema\Operations
Definition:
AddColumn.php:7
Magento\Framework\Setup\Declaration\Schema\Dto\ElementInterface
Definition:
ElementInterface.php:15
Magento\Framework\Setup\Declaration\Schema\Dto\TableElementInterface
Definition:
TableElementInterface.php:13
Magento\Framework\Setup\Declaration\Schema\Db\DefinitionAggregator
Definition:
DefinitionAggregator.php:17
$element
$element
Definition:
element.phtml:12