Skip to content

Commit 401c891

Browse files
committed
refactor!: use DatetimeCast::set() for mutateDate()
From now on, $attributes have PHP values, not raw values from database.
1 parent 3b802de commit 401c891

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

system/Entity/Entity.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,18 +103,21 @@ class Entity implements JsonSerializable
103103
];
104104

105105
/**
106-
* Holds the current values of all class vars.
106+
* Holds the current values of all class properties.
107+
* The values are PHP representation, not the raw values from database.
107108
*
108-
* @var array
109+
* @var array<string, mixed>
109110
*/
110-
protected $attributes = [];
111+
protected $attributes = [
112+
// db_column_name => PHP_value
113+
];
111114

112115
/**
113116
* Holds original copies of all attributes, so we can determine
114117
* what's actually been changed and not accidentally write
115118
* nulls where we shouldn't.
116119
*
117-
* @var array
120+
* @var array<string, mixed>
118121
*/
119122
protected $original = [];
120123

@@ -441,7 +444,7 @@ protected function mapProperty(string $key)
441444
*/
442445
protected function mutateDate($value)
443446
{
444-
return DatetimeCast::get($value);
447+
return DatetimeCast::set($value);
445448
}
446449

447450
/**

0 commit comments

Comments
 (0)