public function rules()
{
return [
[['email', 'phone'], 'atLeastOneRequired'],
];
}
public function atLeastOneRequired($attribute, $params)
{
if (empty($this->email) && empty($this->phone)) {
$this->addError($attribute, 'Please enter either email or phone.');
}
}