Module::t('amossocialauth', 'ID'), 'user_id' => Module::t('amossocialauth', 'User ID'), 'identifier' => Module::t('amossocialauth', 'Unique Identiffier for Provider'), 'profileURL' => Module::t('amossocialauth', 'Provider Profile Url'), 'webSiteURL' => Module::t('amossocialauth', 'Web Site Url'), 'photoURL' => Module::t('amossocialauth', 'Photo Url'), 'displayName' => Module::t('amossocialauth', 'User Display Name'), 'description' => Module::t('amossocialauth', 'User Description'), 'firstName' => Module::t('amossocialauth', 'First Name'), 'lastName' => Module::t('amossocialauth', 'Last Name'), 'gender' => Module::t('amossocialauth', 'Gender'), 'language' => Module::t('amossocialauth', 'Language'), 'email' => Module::t('amossocialauth', 'Email'), 'emailVerified' => Module::t('amossocialauth', 'Email Veriffied'), 'phone' => Module::t('amossocialauth', 'Phone Number'), 'address' => Module::t('amossocialauth', 'Address'), 'country' => Module::t('amossocialauth', 'Country'), 'region' => Module::t('amossocialauth', 'Region'), 'city' => Module::t('amossocialauth', 'City'), 'zip' => Module::t('amossocialauth', 'Zip Code'), 'provider' => Module::t('amossocialauth', 'Provider Name'), 'age' => Module::t('amossocialauth', 'Age'), 'birthDay' => Module::t('amossocialauth', 'Birth Day'), 'birthMonth' => Module::t('amossocialauth', 'Birth Month'), 'birthYear' => Module::t('amossocialauth', 'Birth Year'), 'job_title' => Module::t('amossocialauth', 'Job Title'), 'organization_name' => Module::t('amossocialauth', 'Organization Name'), ]; } /** * @return \yii\db\ActiveQuery */ public function getUser() { return $this->hasOne(User::className(), ['id' => 'user_id']); } public function getServices(){ return $this->hasMany(SocialAuthServices::className(), ['social_users_id' => 'id']); } public function beforeDelete() { // if any service is associated to the linked account, it will be removed and deleted before delete the link itself $services = $this->services; if(!empty($services)){ /** @var Module $socialAuth */ $socialAuth = \Yii::$app->getModule('socialauth'); foreach ($services as $service) { $socialAuth->removeGoogleService($service); $client = $socialAuth->getClient('google'); if(!is_null($client) && !empty($service->access_token)){ $client->revokeToken($service->access_token); } $service->delete(); } } return parent::beforeDelete(); } }