Skip to content

Commit f905e5f

Browse files
committed
MC-32697: [2.4] AbstractSimpleObjectBuilder.php throws exception when Interceptor instance comes.
1 parent 90598c3 commit f905e5f

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,13 @@ protected function _set($key, $value)
6767
*/
6868
protected function _getDataObjectType()
6969
{
70-
$currentClass = get_class($this);
71-
$suffix = 'Builder';
72-
$interceptorSuffix = '\Interceptor';
73-
if (false !== strpos($currentClass, $interceptorSuffix, -strlen($interceptorSuffix))) {
74-
$suffix .= $interceptorSuffix;
70+
$dataObjectType = '';
71+
$pattern = '/(?<data_object>.*?)Builder(\\Interceptor)?/';
72+
if (preg_match($pattern, get_class($this), $match)) {
73+
$dataObjectType = $match['data_object'];
7574
}
7675

77-
return substr($currentClass, 0, -strlen($suffix));
76+
return $dataObjectType;
7877
}
7978

8079
/**

0 commit comments

Comments
 (0)