From 58d926be82dc01d0f743883a5e0506b0ae829ad2 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Mon, 1 Apr 2024 19:40:04 +0300 Subject: [PATCH] orm base entity writtenMap change --- application/Espo/ORM/BaseEntity.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/application/Espo/ORM/BaseEntity.php b/application/Espo/ORM/BaseEntity.php index 45760a5030..366ef61efb 100644 --- a/application/Espo/ORM/BaseEntity.php +++ b/application/Espo/ORM/BaseEntity.php @@ -271,10 +271,11 @@ class BaseEntity implements Entity protected function setInContainer(string $attribute, $value): void { $this->valuesContainer[$attribute] = $value; + $this->writtenMap[$attribute] = true; } /** - * whether an attribute is set in the container. + * Whether an attribute is set in the container. */ protected function hasInContainer(string $attribute): bool { @@ -409,6 +410,9 @@ class BaseEntity implements Entity $this->valueAccessor->set($field, $value); } + /** + * @todo Make private in v9.0. + */ protected function populateFromArrayItem(string $attribute, mixed $value): void { $preparedValue = $this->prepareAttributeValue($attribute, $value); @@ -422,8 +426,6 @@ class BaseEntity implements Entity } $this->setInContainer($attribute, $preparedValue); - - $this->writtenMap[$attribute] = true; } protected function prepareAttributeValue(string $attribute, mixed $value): mixed @@ -965,7 +967,11 @@ class BaseEntity implements Entity continue; } + $wasSet = $this->hasInContainer($attribute); + $this->setInContainer($attribute, $defs['default']); + + $this->writtenMap[$attribute] = $wasSet; } }