Skip to content

Commit 9aaa393

Browse files
author
Roman Ganin
committed
Merge branch 'develop' of github.corp.ebay.com:magento2/magento2ce into MAGETWO-35068
2 parents d6a7d54 + f340c06 commit 9aaa393

File tree

50 files changed

+668
-550
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+668
-550
lines changed

app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Date.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,8 @@ protected function _convertDate($date)
205205
\IntlDateFormatter::NONE,
206206
$adminTimeZone
207207
);
208-
$simpleRes = new \DateTime('@' . $formatter->parse($date), $adminTimeZone);
208+
$simpleRes = new \DateTime(null, $adminTimeZone);
209+
$simpleRes->setTimestamp($formatter->parse($date));
209210
$simpleRes->setTime(0, 0, 0);
210211
$simpleRes->setTimezone(new \DateTimeZone('UTC'));
211212
return $simpleRes;

app/code/Magento/Backup/Model/Backup.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public function load($fileName, $filePath)
152152
'extension' => $this->_helper->getExtensionByType($backupData->getType()),
153153
'display_name' => $this->_helper->nameToDisplayName($backupData->getName()),
154154
'name' => $backupData->getName(),
155-
'date_object' => new \DateTime('@' . $backupData->getTime()),
155+
'date_object' => (new \DateTime())->setTimestamp($backupData->getTime()),
156156
]
157157
);
158158

app/code/Magento/Catalog/Model/Product/Option/Type/Date.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ public function prepareForCart()
165165
$timestamp += 60 * 60 * $value['hour'] + 60 * $value['minute'];
166166
}
167167

168-
$date = new \DateTime('@' . $timestamp);
168+
$date = (new \DateTime())->setTimestamp($timestamp);
169169
$result = $date->format('Y-m-d H:i:s');
170170

171171
// Save date in internal format to avoid locale date bugs
@@ -188,19 +188,22 @@ public function getFormattedOptionValue($optionValue)
188188
{
189189
if ($this->_formattedOptionValue === null) {
190190
if ($this->getOption()->getType() == \Magento\Catalog\Model\Product\Option::OPTION_TYPE_DATE) {
191-
$format = $this->_localeDate->getDateFormat(
192-
\IntlDateFormatter::MEDIUM
191+
$result = $this->_localeDate->formatDateTime(
192+
new \DateTime($optionValue),
193+
\IntlDateFormatter::MEDIUM,
194+
\IntlDateFormatter::NONE
193195
);
194-
$result = \IntlDateFormatter::formatObject(new \DateTime($optionValue), $format);
195196
} elseif ($this->getOption()->getType() == \Magento\Catalog\Model\Product\Option::OPTION_TYPE_DATE_TIME) {
196-
$format = $this->_localeDate->getDateTimeFormat(
197+
$result = $this->_localeDate->formatDateTime(
198+
new \DateTime($optionValue),
199+
\IntlDateFormatter::SHORT,
197200
\IntlDateFormatter::SHORT
198201
);
199-
$result = \IntlDateFormatter::formatObject(new \DateTime($optionValue), $format);
200202
} elseif ($this->getOption()->getType() == \Magento\Catalog\Model\Product\Option::OPTION_TYPE_TIME) {
201-
$result = \IntlDateFormatter::formatObject(
203+
$result = $this->_localeDate->formatDateTime(
202204
new \DateTime($optionValue),
203-
$this->is24hTimeFormat() ? 'H:i' : 'h:i a'
205+
\IntlDateFormatter::NONE,
206+
\IntlDateFormatter::SHORT
204207
);
205208
} else {
206209
$result = $optionValue;

app/code/Magento/CatalogImportExport/Model/Import/Product.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1086,7 +1086,7 @@ protected function _saveProducts()
10861086
$storeIds = [0];
10871087

10881088
if ('datetime' == $attribute->getBackendType() && strtotime($attrValue)) {
1089-
$attrValue = new \DateTime('@' . strtotime($attrValue));
1089+
$attrValue = (new \DateTime())->setTimestamp(strtotime($attrValue));
10901090
$attrValue = $attrValue->format(DateTime::DATETIME_PHP_FORMAT);
10911091
} elseif ($backModel) {
10921092
$attribute->getBackend()->beforeSave($product);

app/code/Magento/CatalogRule/Model/Observer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ public function prepareCatalogProductCollectionPrices(EventObserver $observer)
267267
if ($observer->getEvent()->hasDate()) {
268268
$date = new \DateTime($observer->getEvent()->getDate());
269269
} else {
270-
$date = new \DateTime('@' . $this->_localeDate->scopeTimeStamp($store));
270+
$date = (new \DateTime())->setTimestamp($this->_localeDate->scopeTimeStamp($store));
271271
}
272272

273273
$productIds = [];

app/code/Magento/Customer/view/frontend/templates/form/register.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@
164164
require([
165165
'jquery',
166166
'mage/mage'
167-
], function(jQuery){
167+
], function($){
168168

169169
var dataForm = $('#form-validate');
170170
var ignore = <?php echo $_dob->isEnabled() ? '\'input[id$="full"]\'' : 'null'; ?>;

app/code/Magento/CustomerImportExport/Model/Import/Address.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ protected function _prepareDataForUpdate(array $rowData)
473473
if ('select' == $attributeParams['type']) {
474474
$value = $attributeParams['options'][strtolower($rowData[$attributeAlias])];
475475
} elseif ('datetime' == $attributeParams['type']) {
476-
$value = new \DateTime('@' . strtotime($rowData[$attributeAlias]));
476+
$value = (new \DateTime())->setTimestamp(strtotime($rowData[$attributeAlias]));
477477
$value = $value->format(\Magento\Framework\Stdlib\DateTime::DATETIME_PHP_FORMAT);
478478
} else {
479479
$value = $rowData[$attributeAlias];

app/code/Magento/CustomerImportExport/Model/Import/Customer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,11 +292,11 @@ protected function _prepareDataForUpdate(array $rowData)
292292
$attributesToSave = [];
293293

294294
// entity table data
295-
$now = new \DateTime('@' . time());
295+
$now = new \DateTime();
296296
if (empty($rowData['created_at'])) {
297297
$createdAt = $now;
298298
} else {
299-
$createdAt = new \DateTime('@' . strtotime($rowData['created_at']));
299+
$createdAt = (new \DateTime())->setTimestamp(strtotime($rowData['created_at']));
300300
}
301301
$entityRow = [
302302
'group_id' => empty($rowData['group_id']) ? self::DEFAULT_GROUP_ID : $rowData['group_id'],
@@ -333,7 +333,7 @@ protected function _prepareDataForUpdate(array $rowData)
333333
if ('select' == $attributeParameters['type']) {
334334
$value = $attributeParameters['options'][strtolower($value)];
335335
} elseif ('datetime' == $attributeParameters['type']) {
336-
$value = new \DateTime('@' . strtotime($value));
336+
$value = (new \DateTime())->setTimestamp(strtotime($value));
337337
$value = $value->format(\Magento\Framework\Stdlib\DateTime::DATETIME_PHP_FORMAT);
338338
} elseif ($backendModel) {
339339
$attribute->getBackend()->beforeSave($this->_customerModel->setData($attributeCode, $value));

app/code/Magento/Dhl/Model/Carrier.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,7 @@ protected function _parseResponse($response)
10341034

10351035
if (strlen(trim($response)) > 0) {
10361036
if (strpos(trim($response), '<?xml') === 0) {
1037-
$xml = simplexml_load_string($response);
1037+
$xml = $this->parseXml($response, 'Magento\Shipping\Model\Simplexml\Element');
10381038
if (is_object($xml)) {
10391039
if (in_array($xml->getName(), ['ErrorResponse', 'ShipmentValidateErrorResponse'])
10401040
|| isset($xml->GetQuoteResponse->Note->Condition)
@@ -1775,7 +1775,7 @@ protected function _parseXmlTrackingResponse($trackings, $response)
17751775
$resultArr = [];
17761776

17771777
if (strlen(trim($response)) > 0) {
1778-
$xml = simplexml_load_string($response);
1778+
$xml = $this->parseXml($response, 'Magento\Shipping\Model\Simplexml\Element');
17791779
if (!is_object($xml)) {
17801780
$errorTitle = __('Response is in the wrong format');
17811781
}

app/code/Magento/Eav/Model/EavCustomAttributeTypeLocator.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
use Magento\Framework\Exception\NoSuchEntityException;
1111
use Magento\Framework\Webapi\CustomAttributeTypeLocatorInterface;
1212

13+
/**
14+
* Class to locate types for Eav custom attributes
15+
*/
1316
class EavCustomAttributeTypeLocator implements CustomAttributeTypeLocatorInterface
1417
{
1518
/**
@@ -32,7 +35,22 @@ class EavCustomAttributeTypeLocator implements CustomAttributeTypeLocatorInterfa
3235
*
3336
* @param AttributeRepositoryInterface $attributeRepository
3437
* @param array $serviceEntityTypeMap
38+
* <pre>
39+
* [
40+
* 'ServiceInterfaceA' => 'EavEntityType1',
41+
* 'ServiceInterfaceB' => 'EavEntityType2'
42+
* ]
43+
* </pre>
3544
* @param array $serviceBackendModelDataInterfaceMap
45+
* <pre>
46+
* [
47+
* 'ServiceInterfaceA' => ['BackendType1' => 'ServiceDataInterface1'],
48+
* 'ServiceInterfaceB' => [
49+
* 'BackendType2' => 'ServiceDataInterface2',
50+
* 'BackendType3' => 'ServiceDataInterface3'
51+
* ]
52+
* ]
53+
* </pre>
3654
*/
3755
public function __construct(
3856
AttributeRepositoryInterface $attributeRepository,
@@ -69,4 +87,22 @@ public function getType($attributeCode, $serviceClass)
6987

7088
return $dataInterface;
7189
}
90+
91+
/**
92+
* {@inheritdoc}
93+
*/
94+
public function getAllServiceDataInterfaces()
95+
{
96+
$dataInterfaceArray = [];
97+
if (!$this->serviceBackendModelDataInterfaceMap) {
98+
return [];
99+
} else {
100+
foreach ($this->serviceBackendModelDataInterfaceMap as $serviceArray) {
101+
foreach ($serviceArray as $dataInterface) {
102+
$dataInterfaceArray[] = $dataInterface;
103+
}
104+
}
105+
}
106+
return $dataInterfaceArray;
107+
}
72108
}

0 commit comments

Comments
 (0)