Propel2
Propel2 copied to clipboard
FIX failing queries on datetime fields set to 1970-01-01 00:00:00 via (int) 0
The Problem was the not-type-safe null-check in the PropelDateTime util class. Passing an Integer 0 (that e.g. comes from the SplFileInfo::getMtime()) to the setter of the field, results in the 0 being interpreted as null, thus the update/insert query is failing.
FIxes #2010
Hmmm... I'm afraid I might need some help with the failing CI tests, to me that looks unrelated to my change and more like some init failure?
@PhilinTv this makes sense to me.
This deserves a note in the release notes I think:
Remove
defaultValue="0"from DATETIME|TIMESTAMP column elements in your schema. 0 will now set it to the unix epoch instead of NULL. This is also applicable if you do the same calling a setter of a generated class.
@hsegnitz can you please rebase this PR so tests run? Test errors were fixed recently and that's the easiest way to make them run currently :) This looks good to merge afterwards (if the breaking change is acceptable to others).
@hsegnitz thanks for the fix!