Skip to content

Commit

Permalink
Fixed toArray (#686)
Browse files Browse the repository at this point in the history
Co-authored-by: Deeka Wong <[email protected]>
  • Loading branch information
huangdijia and huangdijia committed Jul 15, 2024
1 parent b6dd4a2 commit a7dd89d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/SimpleDTO.php
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,10 @@ private function mapDTOData(array $mapping, array $data): array
? $mapping[$key]
: $key;

if (isset($this->{$key}) && $value !== $this->{$key}) {
$value = $this->{$key};
}

$mappedData[$property] = $this->isArrayable($value)
? $this->formatArrayableValue($value)
: $value;
Expand Down

0 comments on commit a7dd89d

Please sign in to comment.