Skip to content
Browse files

don't fail validation for non-required int fields that are not present

  • Loading branch information...
1 parent f2a868a commit f12c88d87fa23f1a0c83d9b63c9f355b73b4975d Nick committed
Showing with 1 addition and 0 deletions.
  1. +1 −0 src/redmodel/meta/constraint/type.php
View
1 src/redmodel/meta/constraint/type.php
@@ -34,6 +34,7 @@ public function check () {
return $this->dispatch(is_numeric($fval),
"{$this->field->title} must be numeric");
case 'int': case 'integer': case 'integral':
+ if (!$required && !$fval) return $this->dispatch(true);
return $this->dispatch(is_numeric($fval) && ($fval == round($fval)),
"{$this->field->title} must be a whole number");
case 'date':

0 comments on commit f12c88d

Please sign in to comment.
Something went wrong with that request. Please try again.