Propel2 icon indicating copy to clipboard operation
Propel2 copied to clipboard

FIX failing queries on datetime fields set to 1970-01-01 00:00:00 via (int) 0

Open hsegnitz opened this issue 1 year ago • 1 comments

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

hsegnitz avatar Jun 28 '24 22:06 hsegnitz

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?

hsegnitz avatar Jun 29 '24 07:06 hsegnitz

@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.

smhg avatar Apr 15 '25 13:04 smhg

@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).

smhg avatar May 01 '25 06:05 smhg

@hsegnitz thanks for the fix!

PhilinTv avatar May 14 '25 16:05 PhilinTv