propelorm/sfPropelORMPlugin — Issue #103: Impossible to use MySQL's non-NULL Datetime
Author: coviex
Created: 2012-01-06 16:46:04+00:00
State: open

Hi,

MySQL table has:

`done_at` datetime NOT NULL

AFAIK in Propel Datetime maps to timestamp.
So schema.yml has:

done_at: { type: timestamp }

Result is:

DateTime::__construct(): Failed to parse time string (0) at position 0 (0): Unexpected character

when I try to setDoneAt() on model with empty ('0000-00-00 00:00:00') property.
Error seems to be in setDoneAt() in line:

$currentDateAsString = ($this->checked_at !== null && $tmpDt = new DateTime($this->checked_at)) ? $tmpDt->format('Y-m-d H:i:s') : null;

Cheers