Skip to content

Commit

Permalink
Fix empty DateTime string inflection
Browse files Browse the repository at this point in the history
  • Loading branch information
c9s committed Jun 21, 2016
1 parent b33366a commit b378571
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/Inflator.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ public static function inflate($value, $isa = null)
if (is_string($value)) {
return new DateTime($value);
}

return;
return NULL;
}

return $value;
Expand Down
4 changes: 4 additions & 0 deletions src/Schema/RuntimeColumn.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,10 @@ public function typeCasting($value)
return intval($value);
} elseif ($isa === 'str') {
return (string) $value;
} elseif ($isa === 'DateTime') {
if ($value === '' || $value === 0 || $value === false) {
return null;
}
} elseif ($isa === 'bool') {
if ($value === null) {
return;
Expand Down

0 comments on commit b378571

Please sign in to comment.