public function validate(FieldDefinition $fieldDefinition, SPIValue $fieldValue)
{
$validationErrors = array();
if ($this->isEmptyValue($fieldValue)) {
return $validationErrors;
}
$validatorConfiguration = $fieldDefinition->getValidatorConfiguration();
$constraints = isset($validatorConfiguration['IntegerValueValidator']) ? $validatorConfiguration['IntegerValueValidator'] : array();
$validationErrors = array();
// 0 and False are unlimited value for maxIntegerValue
if (isset($constraints['maxIntegerValue']) && $constraints['maxIntegerValue'] !== 0 && $constraints['maxIntegerValue'] !== false && $fieldValue->value > $constraints['maxIntegerValue']) {
$validationErrors[] = new ValidationError('The value can not be higher than %size%.', null, array('%size%' => $constraints['maxIntegerValue']), 'value');
}
if (isset($constraints['minIntegerValue']) && $constraints['minIntegerValue'] !== false && $fieldValue->value < $constraints['minIntegerValue']) {
$validationErrors[] = new ValidationError('The value can not be lower than %size%.', null, array('%size%' => $constraints['minIntegerValue']), 'value');
}
return $validationErrors;
}