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
Dto
Factories
Timestamp.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Framework\Setup\Declaration\Schema\Dto\Factories
;
7
8
use
Magento\Framework\ObjectManagerInterface
;
9
use
Magento\Framework\Stdlib\BooleanUtils
;
10
22
class
Timestamp
implements
FactoryInterface
23
{
27
const
NULL_TIMESTAMP
=
'NULL'
;
28
32
private
$objectManager;
33
37
private
$className;
38
42
private
$booleanUtils;
43
51
public
function
__construct
(
52
ObjectManagerInterface
$objectManager,
53
BooleanUtils
$booleanUtils,
54
$className = \
Magento
\Framework\Setup\Declaration\
Schema
\Dto\Columns\Timestamp::class
55
) {
56
$this->objectManager =
$objectManager
;
57
$this->className = $className;
58
$this->booleanUtils = $booleanUtils;
59
}
60
64
public
function
create
(array
$data
)
65
{
66
$data
[
'onUpdate'
] = isset(
$data
[
'on_update'
]) ?
$data
[
'on_update'
] :
null
;
67
//OnUpdate is boolean as there is only one possible value for onUpdate statement.
68
if
(
$data
[
'onUpdate'
] &&
$data
[
'onUpdate'
] !==
'CURRENT_TIMESTAMP'
) {
69
if
($this->booleanUtils->toBoolean(
$data
[
'onUpdate'
])) {
70
$data
[
'onUpdate'
] =
'CURRENT_TIMESTAMP'
;
71
}
else
{
72
unset(
$data
[
'onUpdate'
]);
73
}
74
}
75
//By default default attribute is not used.
76
if
(!isset(
$data
[
'default'
])) {
77
$data
[
'default'
] =
self::NULL_TIMESTAMP
;
78
}
79
80
return
$this->objectManager->create($this->className,
$data
);
81
}
82
}
$objectManager
$objectManager
Definition:
bootstrap.php:17
Magento\Framework\ObjectManagerInterface
Definition:
ObjectManagerInterface.php:12
Magento\Framework\Setup\Declaration\Schema\Dto\Factories\Timestamp\create
create(array $data)
Definition:
Timestamp.php:64
Magento\Framework\Setup\Declaration\Schema\Dto\Factories
Definition:
Blob.php:6
Magento\Framework\Setup\Declaration\Schema\Dto\Factories\FactoryInterface
Definition:
FactoryInterface.php:13
$data
$data
Definition:
attribute_set_with_image_attribute.php:16
Magento
Magento\Framework\Stdlib\BooleanUtils
Definition:
BooleanUtils.php:14
Magento\Framework\Setup\Declaration\Schema\Dto\Schema
Definition:
Schema.php:15
Magento\Framework\Setup\Declaration\Schema\Dto\Factories\Timestamp
Definition:
Timestamp.php:22
Magento\Framework\Setup\Declaration\Schema\Dto\Factories\Timestamp\__construct
__construct(ObjectManagerInterface $objectManager, BooleanUtils $booleanUtils, $className=\Magento\Framework\Setup\Declaration\Schema\Dto\Columns\Timestamp::class)
Definition:
Timestamp.php:51
Magento\Framework\Setup\Declaration\Schema\Dto\Factories\Timestamp\NULL_TIMESTAMP
const NULL_TIMESTAMP
Definition:
Timestamp.php:27