diff --git a/lib/Doctrine/DBAL/Types/DateTimeType.php b/lib/Doctrine/DBAL/Types/DateTimeType.php index ee24756245600464e2c11216508e5697753a92b6..1aca8bab257c4869171a858cc8b2761b2663516a 100644 --- a/lib/Doctrine/DBAL/Types/DateTimeType.php +++ b/lib/Doctrine/DBAL/Types/DateTimeType.php @@ -23,11 +23,13 @@ class DateTimeType extends Type public function convertToDatabaseValue($value, AbstractPlatform $platform) { - return $value->format($platform->getDateTimeFormatString()); + return ($value !== null) + ? $value->format($platform->getDateTimeFormatString()) : null; } public function convertToPHPValue($value, AbstractPlatform $platform) { - return \DateTime::createFromFormat($platform->getDateTimeFormatString(), $value); + return ($value !== null) + ? \DateTime::createFromFormat($platform->getDateTimeFormatString(), $value) : null; } } \ No newline at end of file diff --git a/lib/Doctrine/DBAL/Types/DateType.php b/lib/Doctrine/DBAL/Types/DateType.php index 58cf54b263dd3791b516be61b2eb2ab29a65a2e0..29aee72add2f96bf4431978d7c9bc0055aeb0ff7 100644 --- a/lib/Doctrine/DBAL/Types/DateType.php +++ b/lib/Doctrine/DBAL/Types/DateType.php @@ -23,11 +23,13 @@ class DateType extends Type public function convertToDatabaseValue($value, AbstractPlatform $platform) { - return $value->format($platform->getDateFormatString()); + return ($value !== null) + ? $value->format($platform->getDateFormatString()) : null; } public function convertToPHPValue($value, AbstractPlatform $platform) { - return \DateTime::createFromFormat($platform->getDateFormatString(), $value); + return ($value !== null) + ? \DateTime::createFromFormat($platform->getDateFormatString(), $value) : null; } } \ No newline at end of file diff --git a/lib/Doctrine/DBAL/Types/TimeType.php b/lib/Doctrine/DBAL/Types/TimeType.php index 8256a5570313d311c21afb014a9e0a4ec1dc5cef..e6e1b6882e137aa81c1c94ad78709f8770992b0d 100644 --- a/lib/Doctrine/DBAL/Types/TimeType.php +++ b/lib/Doctrine/DBAL/Types/TimeType.php @@ -31,7 +31,8 @@ class TimeType extends Type */ public function convertToDatabaseValue($value, AbstractPlatform $platform) { - return $value->format($platform->getTimeFormatString()); + return ($value !== null) + ? $value->format($platform->getTimeFormatString()) : null; } /** @@ -41,6 +42,7 @@ class TimeType extends Type */ public function convertToPHPValue($value, AbstractPlatform $platform) { - return \DateTime::createFromFormat($platform->getTimeFormatString(), $value); + return ($value !== null) + ? \DateTime::createFromFormat($platform->getTimeFormatString(), $value) : null; } } \ No newline at end of file