Created
February 14, 2019 19:49
-
-
Save TomHAnderson/f6789ba6dd6a54871eb0da365997cf23 to your computer and use it in GitHub Desktop.
DateTimeMicrosecondType
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function convertToPHPValue($value, AbstractPlatform $platform) | |
{ | |
if ($value === null || $value instanceof DateTimeInterface) { | |
return $value; | |
} | |
$val = DateTime::createFromFormat('Y-m-d H:i:s.u', $value); | |
if (! $val) { | |
$val = date_create($value); | |
} | |
if (! $val) { | |
throw ConversionException::conversionFailedFormat( | |
$value, | |
$this->getName(), | |
'Y-m-d H:i:s.u' | |
); | |
} | |
return $val; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment