fix clone
This commit is contained in:
@@ -29,14 +29,14 @@
|
||||
|
||||
namespace Espo\Core\Utils;
|
||||
|
||||
use StdClass;
|
||||
use stdClass;
|
||||
|
||||
class ObjectUtil
|
||||
{
|
||||
/**
|
||||
* Deep clone.
|
||||
*/
|
||||
public static function clone(StdClass $source): StdClass
|
||||
public static function clone(StdClass $source): stdClass
|
||||
{
|
||||
$cloned = (object) [];
|
||||
|
||||
@@ -52,8 +52,8 @@ class ObjectUtil
|
||||
if (is_array($item)) {
|
||||
$cloned = [];
|
||||
|
||||
foreach ($item as $v) {
|
||||
$cloned[] = self::cloneItem($v);
|
||||
foreach ($item as $i => $v) {
|
||||
$cloned[$i] = self::cloneItem($v);
|
||||
}
|
||||
|
||||
return $cloned;
|
||||
|
||||
@@ -1037,20 +1037,20 @@ class BaseEntity implements Entity
|
||||
|
||||
$copy = [];
|
||||
|
||||
foreach ($value as $item) {
|
||||
foreach ($value as $i => $item) {
|
||||
if (is_object($item)) {
|
||||
$copy[] = $this->cloneObject($item);
|
||||
$copy[$i] = $this->cloneObject($item);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (is_array($item)) {
|
||||
$copy[] = $this->cloneArray($item);
|
||||
$copy[$i] = $this->cloneArray($item);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$copy[] = $item;
|
||||
$copy[$i] = $item;
|
||||
}
|
||||
|
||||
return $copy;
|
||||
|
||||
Reference in New Issue
Block a user