public function setValue($newValue) { if (!empty($newValue)) { $validator = new EmailValidator($newValue); if (!$validator->isValid()) { throw new \InvalidArgumentException(sprintf('Not an email: "%s"', $newValue)); } } return parent::setValue($newValue); }
public function setValue($newValue) { if (!$this->isUniq($newValue)) { throw new \ForbiddenException('Login `' . $newValue . '` already used'); } if (empty($newValue)) { throw new \InvalidArgumentException('Login can`t be empty'); } parent::setValue($newValue); }