Skip to content

Commit

Permalink
Merge branch 'feature/nulldate'
Browse files Browse the repository at this point in the history
  • Loading branch information
cambell-prince committed Feb 23, 2022
2 parents db02b4c + 3a63b8c commit e4bd6da
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Transform/SqlDateTimeTransform.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ public function __construct($format = 'Y-m-d H:i:s')

public function txDatabaseToModel($value)
{
return new \DateTime($value);
return $value !== null ? new \DateTime($value) : null;
}

public function txModelToDatabase(/** @var \DateTime */$value)
{
return $value->format($this->format);
return $value !== null ? $value->format($this->format) : null;
}

}

0 comments on commit e4bd6da

Please sign in to comment.