Skip to content

Commit

Permalink
Merge pull request #9 from giftcards/master
Browse files Browse the repository at this point in the history
DateTime objects break the "date" validator
  • Loading branch information
Nimrod Ram authored Jan 25, 2017
2 parents a90d5d8 + f924a2c commit 188c2d2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Riskified/OrderWebhook/Model/AbstractModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ public function __construct($props = array()) {
foreach ($props as $key => $value) {
if (!array_key_exists($key, $this->_fields))
throw new Exception\InvalidPropertyException($this, $key);

if($value instanceof \DateTime) {
$value = $value->format('c');
}
$this->{$key} = $value;
}
}
Expand Down

0 comments on commit 188c2d2

Please sign in to comment.