_user = User::findByVerificationToken($token); if (!$this->_user) { throw new InvalidArgumentException('Wrong verify email token.'); } parent::__construct($config); } /** * Verify email * * @return User|null the saved model or null if saving fails */ public function verifyEmail() { $user = $this->_user; $user->status = User::STATUS_ACTIVE; return $user->save(false) ? $user : null; } }