public function rules(): array
{
return [
[['contact_email'], 'string', 'max' => 255],
[['contact_email'], 'email'],
[['contact_email'], 'editNotEmail', 'on' => self::EXPERT_UPDATE]
];
}
public function editNotEmail($attribute, $params)
{
if ($this->scenario === self::EXPERT_UPDATE) {
if ($this->oldAttributes['contact_email'] !== $this->contact_email) {
$this->addError($attribute, 'Невозможно изменять: ' . $attribute);
}
}
}