{"action":"opened","issue":{"url":"https://api.github.com/repos/SocalNick/ScnSocialAuth/issues/202","labels_url":"https://api.github.com/repos/SocalNick/ScnSocialAuth/issues/202/labels{/name}","comments_url":"https://api.github.com/repos/SocalNick/ScnSocialAuth/issues/202/comments","events_url":"https://api.github.com/repos/SocalNick/ScnSocialAuth/issues/202/events","html_url":"https://github.com/SocalNick/ScnSocialAuth/issues/202","id":68836776,"number":202,"title":"How to (correctly) extend ScnSocialAuth\\Authentication\\Adapter\\HybridAuth::authenticate() method?","user":{"login":"diogodomanski","id":3011678,"avatar_url":"https://avatars.githubusercontent.com/u/3011678?v=3","gravatar_id":"","url":"https://api.github.com/users/diogodomanski","html_url":"https://github.com/diogodomanski","followers_url":"https://api.github.com/users/diogodomanski/followers","following_url":"https://api.github.com/users/diogodomanski/following{/other_user}","gists_url":"https://api.github.com/users/diogodomanski/gists{/gist_id}","starred_url":"https://api.github.com/users/diogodomanski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/diogodomanski/subscriptions","organizations_url":"https://api.github.com/users/diogodomanski/orgs","repos_url":"https://api.github.com/users/diogodomanski/repos","events_url":"https://api.github.com/users/diogodomanski/events{/privacy}","received_events_url":"https://api.github.com/users/diogodomanski/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-04-16T03:36:01Z","updated_at":"2015-04-16T03:36:01Z","closed_at":null,"body":"Hi,\r\n\r\nI'm using ScnSocialAuth + Doctrine in a ZF2 application. I need to add some fields to \"user\" and \"user_provider\" tables and populate them during authentication process.\r\n\r\nWhat I've done up to now was:\r\n1. alter these tables structures (adding the fields I need)\r\n2. create two custom entities to override the default ones (ZfcUser\\Entity\\User and ScnSocialAuth\\Entity\\UserProvider) with the needed fields (and their getters and setters methods)\r\n3. modify config files to use these new entities (zfcuser.global.php and scn-social-auth.global.php) instead the default ones\r\n\r\nWhat I need now is to use the user's profile data (for example, from Facebook) to hydrate my custom User and UserProvider entities, so they populate the records to be inserted/updated into \"user\" and \"user_provider\" tables.\r\n\r\nLooking into ScnSocialAuth\\Authentication\\Adapter\\HybridAuth class I've realized that there are some methods that aims to hydrate these entities with the values from user's profile data. These methods have the name like <provider>ToLocalUser().\r\n\r\nThe problem is that they set only a few attributes of the entities. For example, the facebookToLocalUser do the following:\r\n\r\n```php\r\nprotected function facebookToLocalUser($userProfile)\r\n    {\r\n        ...\r\n\r\n        $localUser = $this->instantiateLocalUser();\r\n        $localUser->setEmail($userProfile->emailVerified)\r\n            ->setDisplayName($userProfile->displayName)\r\n            ->setPassword(__FUNCTION__);\r\n        $result = $this->insert($localUser, 'facebook', $userProfile);\r\n\r\n        return $localUser;\r\n    }\r\n```\r\n\r\nMy question is: how can I make the authentication process populate custom User and UserProvider entities correctly?\r\n\r\nThanks"}}