Skip to content

Commit bdb8db6

Browse files
committed
Fixed default values
1 parent 4f2e910 commit bdb8db6

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/DTO.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,22 @@ private function processDefaultValues()
8080

8181
foreach ($defaults as $key => $value) {
8282

83+
84+
if ( (!isset($this->data[$key])) || (empty($this->data[$key])) ) {
85+
$this->{$key} = $value;
86+
$this->data[$key] = $value;
87+
$this->dataValidated[$key] = $value;
88+
}
89+
/*
90+
8391
if (!property_exists($this, $key) || empty($this->{$key}) ) {
92+
8493
$this->{$key} = $value;
8594
$this->data[$key] = $value;
8695
$this->dataValidated[$key] = $value;
96+
8797
}
98+
*/
8899

89100
}
90101

@@ -186,4 +197,3 @@ abstract protected function defaults(): array;
186197
abstract protected function casts(): array;
187198

188199
}
189-

0 commit comments

Comments
 (0)