Sokil\Mongo\Validator\LessValidator::validateField PHP Method

validateField() public method

public validateField ( Structure $document, $fieldName, array $params )
$document Sokil\Mongo\Structure
$params array
    public function validateField(Structure $document, $fieldName, array $params)
    {
        $value = $document->get($fieldName);
        if (!$value) {
            return;
        }
        if (!isset($params['than'])) {
            throw new Exception('Maximum value not specified');
        }
        if ($value >= $params['than']) {
            if (empty($params['message'])) {
                $params['message'] = 'Field "' . $fieldName . '" must be less than specified value in ' . get_called_class();
            }
            $document->addError($fieldName, $this->getName(), $params['message']);
        }
    }
LessValidator