[Validator] Allow DateTime objects as valid DateTimes
This commit is contained in:
parent
2862c6cce4
commit
82f6a68eb2
@ -16,6 +16,10 @@ class DateTimeValidator extends ConstraintValidator
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($value instanceof \DateTime) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString()'))) {
|
||||
throw new UnexpectedTypeException($value, 'string');
|
||||
}
|
||||
|
Reference in New Issue
Block a user