[2.0][DDC-30] Fixed null values with Date, Time and DateTime types. Thanks Ismo for report and patch
This commit is contained in:
parent
dce2d79046
commit
679191a426
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user