Skip to content

Commit

Permalink
Merge pull request #7 from BrandEmbassy/fix-datetime-for-doctrine
Browse files Browse the repository at this point in the history
fix nullable datetime type for doctrine
  • Loading branch information
ikvasnica authored May 10, 2019
2 parents ed2f991 + f6683ea commit 3686523
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Doctrine/DateTimeImmutableAsTimestampDoctrineType.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@ final class DateTimeImmutableAsTimestampDoctrineType extends Type
/**
* @param mixed $value
*/
public function convertToDatabaseValue($value, AbstractPlatform $platform): int
public function convertToDatabaseValue($value, AbstractPlatform $platform): ?int
{
if ($value === null) {
return null;
}

if (!$value instanceof DateTimeImmutable) {
throw new InvalidArgumentException('Given value is not instance of DateTimeImmutable.');
}
Expand Down

0 comments on commit 3686523

Please sign in to comment.