When database content has '0000-00-00' or '0000-00-00 00:00:00' values that are to be loaded in DateTime properties, this poses a problem because these entities cannot be stored without causing a database error. The DateTime object, when loaded contains an invalid value:
In all likelyhood, 0000-00-00 was never meant to be a valid date, but a way to express "empty" or "not set". Because PHP's null value is a more appropriate way to represent this, I propose to change the behaviour of DateTime(Immutable) properties to load a value as NULL instead of an invalid DateTime object.
When database content has '0000-00-00' or '0000-00-00 00:00:00' values that are to be loaded in DateTime properties, this poses a problem because these entities cannot be stored without causing a database error. The DateTime object, when loaded contains an invalid value:
When tryin to store an entity containing this value in MySQL or MariaDB, you'll get:
In all likelyhood, 0000-00-00 was never meant to be a valid date, but a way to express "empty" or "not set". Because PHP's null value is a more appropriate way to represent this, I propose to change the behaviour of DateTime(Immutable) properties to load a value as NULL instead of an invalid DateTime object.