Skip to content

Commit a145592

Browse files
committed
MCP-767: Improve Consumers Order Creation Throughput
1 parent 7957ce2 commit a145592

File tree

2 files changed

+26
-12
lines changed

2 files changed

+26
-12
lines changed

lib/internal/Magento/Framework/Api/DataObjectHelper.php

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ public function getCustomAttributeValueByType(array $attributeValues, $type)
281281
}
282282

283283
/** @var array */
284-
private $settersCache = [];
284+
private array $settersCache = [];
285285

286286
/**
287287
* Get list of setters for object
@@ -295,17 +295,19 @@ private function getSetters(object $dataObject): array
295295
if (!isset($this->settersCache[$class])) {
296296
$dataObjectMethods = get_class_methods($class);
297297
// use regexp to manipulate with method list as it use jit starting with PHP 7.3
298-
$setters = explode(
299-
',',
300-
strtolower(
301-
// (0) remove all not setter
302-
// (1) add _ before upper letter
303-
// (2) remove set_ in start of name
304-
// (3) add name without is_ prefix
305-
preg_replace(
306-
['/(^|,)(?!set)[^,]*/S','/(.)([A-Z])/S', '/(^|,)set_/iS', '/(^|,)is_([^,]+)/is'],
307-
['', '$1_$2', '$1', '$1$2,is_$2'],
308-
implode(',', $dataObjectMethods)
298+
$setters = array_filter(
299+
explode(
300+
',',
301+
strtolower(
302+
// (0) remove all not setter
303+
// (1) add _ before upper letter
304+
// (2) remove set_ in start of name
305+
// (3) add name without is_ prefix
306+
preg_replace(
307+
['/(^|,)(?!set)[^,]*/S','/(.)([A-Z])/S', '/(^|,)set_/iS', '/(^|,)is_([^,]+)/is'],
308+
['', '$1_$2', '$1', '$1$2,is_$2'],
309+
implode(',', $dataObjectMethods)
310+
)
309311
)
310312
)
311313
);

lib/internal/Magento/Framework/Api/ImageContent.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,18 @@ public function setBase64EncodedData($data)
5656
return $this->setData(self::BASE64_ENCODED_DATA, $data);
5757
}
5858

59+
/**
60+
* {@inheritdoc}
61+
*/
62+
public function setData($key, $value)
63+
{
64+
if ($key === 'base_64_encoded_data') {
65+
return parent::setData(self::BASE64_ENCODED_DATA, $value);
66+
}
67+
68+
return parent::setData($key, $value);
69+
}
70+
5971
/**
6072
* {@inheritdoc}
6173
*

0 commit comments

Comments
 (0)