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
SchemaListenerDefinition
RealDefinition.php
Go to the documentation of this file.
1
<?php
7
namespace
Magento\Framework\Setup\SchemaListenerDefinition
;
8
12
class
RealDefinition
implements
DefinitionConverterInterface
13
{
19
private
static
$shapeByType = [
20
'float'
=> [
21
'precision'
=>
'0'
,
22
'scale'
=>
'0'
23
],
24
'decimal'
=> [
25
'precision'
=>
'0'
,
26
'scale'
=>
'10'
27
],
28
'double'
=> [
29
'precision'
=>
'0'
,
30
'scale'
=>
'0'
31
]
32
];
33
37
public
function
convertToDefinition
(array $definition)
38
{
39
if
(isset($definition[
'length'
])) {
40
list($definition[
'precision'
], $definition[
'scale'
]) = explode(
","
, $definition[
'length'
]);
41
}
42
return
[
43
'xsi:type'
=> $definition[
'type'
],
44
'name'
=> $definition[
'name'
],
45
//In previous adapter this 2 fields were switched, so we need to switch again
46
'scale'
=> $definition[
'scale'
] ?? self::$shapeByType[$definition[
'type'
]][
'scale'
],
47
'precision'
=> $definition[
'precision'
] ?? self::$shapeByType[$definition[
'type'
]][
'precision'
],
48
'unsigned'
=> $definition[
'unsigned'
] ??
false
,
49
'nullable'
=> $definition[
'nullable'
] ??
true
,
50
'default'
=> isset($definition[
'default'
]) && $definition[
'default'
] !==
false
?
51
(int) $definition[
'default'
] :
null
,
52
'primary'
=> $definition[
'primary'
] ??
false
53
];
54
}
55
}
Magento\Framework\Setup\SchemaListenerDefinition\DefinitionConverterInterface
Definition:
DefinitionConverterInterface.php:12
Magento\Framework\Setup\SchemaListenerDefinition\RealDefinition
Definition:
RealDefinition.php:12
Magento\Framework\Setup\SchemaListenerDefinition
Definition:
BooleanDefinition.php:7
Magento\Framework\Setup\SchemaListenerDefinition\RealDefinition\convertToDefinition
convertToDefinition(array $definition)
Definition:
RealDefinition.php:37