-
Notifications
You must be signed in to change notification settings - Fork 351
Closed
Labels
FeatureNew functionality not yet included in SuluNew functionality not yet included in Sulu
Milestone
Description
Problem description
Currently we are using in a lot of places still DateTime
object. DateTime object is mutable. Which means I can call $someObject->getCreated()->modify('+1 day')
to modify maybe accidently the created or changed date of a entity.
Proposed solution
For safer code and avoid accidently changing datetimes from outside we should where possible migrate the Entities to DateTimeImmutable
.
<field name="created" type="datetime" />
<field name="created" type="datetime_immutable" />
The TimestampableInterface
and TimestampableTrait
should also be replaced and its metadatalistener. Maybe we should check over the whole code base where it make sense.
Specific functions which require currently a DateTime may should use the DateTimeInterface like we adopted already here: #7702
Metadata
Metadata
Assignees
Labels
FeatureNew functionality not yet included in SuluNew functionality not yet included in Sulu