Release 2.16 (#4780)
This commit is contained in:
@@ -49,8 +49,6 @@ final class UTCDateTimeType extends DateTimeType
|
||||
|
||||
/**
|
||||
* @param mixed $value
|
||||
* @param AbstractPlatform $platform
|
||||
* @return null|\DateTime
|
||||
* @throws ConversionException
|
||||
*/
|
||||
public function convertToPHPValue($value, AbstractPlatform $platform): ?\DateTime
|
||||
@@ -59,20 +57,22 @@ final class UTCDateTimeType extends DateTimeType
|
||||
return $value;
|
||||
}
|
||||
|
||||
$converted = \DateTime::createFromFormat(
|
||||
$platform->getDateTimeFormatString(),
|
||||
$value,
|
||||
self::getUtc()
|
||||
);
|
||||
|
||||
if (!$converted) {
|
||||
throw ConversionException::conversionFailedFormat(
|
||||
if (\is_string($value)) {
|
||||
$converted = \DateTime::createFromFormat(
|
||||
$platform->getDateTimeFormatString(),
|
||||
$value,
|
||||
Types::DATETIME_MUTABLE,
|
||||
$platform->getDateTimeFormatString()
|
||||
self::getUtc()
|
||||
);
|
||||
|
||||
if ($converted !== false) {
|
||||
return $converted;
|
||||
}
|
||||
}
|
||||
|
||||
return $converted;
|
||||
throw ConversionException::conversionFailedFormat(
|
||||
$value,
|
||||
Types::DATETIME_MUTABLE,
|
||||
$platform->getDateTimeFormatString()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user