| @@ 890-900 (lines=11) @@ | ||
| 887 | /** |
|
| 888 | * @return boolean |
|
| 889 | */ |
|
| 890 | public function validateRequired() |
|
| 891 | { |
|
| 892 | $val = $this->val(); |
|
| 893 | if ($this['required'] && empty($val) && !is_numeric($val)) { |
|
| 894 | $this->validator()->error('Value is required.', 'required'); |
|
| 895 | ||
| 896 | return false; |
|
| 897 | } |
|
| 898 | ||
| 899 | return true; |
|
| 900 | } |
|
| 901 | ||
| 902 | /** |
|
| 903 | * @return boolean |
|
| @@ 440-450 (lines=11) @@ | ||
| 437 | * |
|
| 438 | * @return boolean |
|
| 439 | */ |
|
| 440 | public function validateAllowEmpty() |
|
| 441 | { |
|
| 442 | $val = $this->val(); |
|
| 443 | if (!$this['allowEmpty'] && empty($val) && !is_numeric($val)) { |
|
| 444 | $this->validator()->error('Value can not be empty.', 'allowEmpty'); |
|
| 445 | ||
| 446 | return false; |
|
| 447 | } |
|
| 448 | ||
| 449 | return true; |
|
| 450 | } |
|
| 451 | ||
| 452 | /** |
|
| 453 | * Parse a value. (From `AbstractProperty`). |
|