/** * Creates a form model given a token. * * @param string $token * @param array $config * @throws \yii\base\InvalidParamException if token is empty or not valid */ public function __construct($token, $config = []) { if (empty($token) || !is_string($token)) { throw new InvalidParamException('Отсутствует код подтверждения.'); } $this->_user = User::findByEmailConfirmToken($token); if (!$this->_user) { throw new InvalidParamException('Неверный токен.'); } parent::__construct($config); }