mvc: UnqiueIdField special validation message

If we ever derive from UnqiueIdField we would end up overwriting
this message and there is no data validation involved which the
message would be for so it can be null as per BaseField.
This commit is contained in:
Franco Fichtner 2023-09-22 11:29:32 +02:00
parent 8d8cc03ac3
commit 2cd5fcac5c

View File

@ -41,11 +41,6 @@ class UniqueIdField extends BaseField
*/
protected $internalIsContainer = false;
/**
* @var string default validation message string
*/
protected $internalValidationMessage = "Unique ID is immutable";
/**
* @var null|string initial field value
*/
@ -67,8 +62,10 @@ class UniqueIdField extends BaseField
}
$validators = parent::getValidators();
// unique id may not change..
$validators[] = new InclusionIn(array('message' => $this->internalValidationMessage,
'domain' => array($this->initialValue)));
$validators[] = new InclusionIn([
'message' => gettext('Unique ID is immutable.'),
'domain' => [$this->initialValue],
]);
return $validators;
}
}