{"action":"created","comment":{"url":"https://api.github.com/repos/hwi/HWIOAuthBundle/pulls/comments/47205859","id":47205859,"diff_hunk":"@@ -0,0 +1,188 @@\n+Step 4: Integrating with FOSUserBundle\n+======================================\n+\n+If you use FOSUserBundle and you want to integrate it with HWIOAuthBundle this article will describe most mahor\n+FOSUserBundle is the most popular Symfony2 bundle, and when you use HWIOAuthBundle for allow to users to authenticate\n+through different networks and services you obviously want to integrate you User class with HWIOauthBundle.\n+\n+Consider that you have been successfully configure any provider (e.g [Adding \"Facebook Connect\" functionality](bonus/facebook-connect.md))\n+\n+### 1) Add resource properties for User class\n+\n+Update your User class, by add properties for storing provider user id and access token. It may looks like:\n+\n+```php\n+namespace MyBundle\\Entity;\n+\n+use FOS\\UserBundle\\Model\\User as FOSUBUser;\n+use Doctrine\\ORM\\Mapping as ORM;\n+\n+/**\n+ * @ORM\\Table(name=\"users\")\n+ * @ORM\\Entity\n+ */\n+class User extends FOSUBUser\n+{\n+    /**\n+     * @ORM\\Column(name=\"id\", type=\"integer\")\n+     * @ORM\\Id\n+     * @ORM\\GeneratedValue(strategy=\"AUTO\")\n+     */\n+    protected $id;\n+\n+    /**\n+     * @ORM\\Column(name=\"facebook_id\", type=\"string\", length=255, nullable=true)\n+     */\n+    private $facebookId;\n+\n+    /**\n+     * @ORM\\Column(name=\"facebook_access_token\", type=\"string\", length=255, nullable=true)\n+     */\n+    private $facebookAccessToken;\n+\n+    /**\n+     * @return integer\n+     */\n+    public function getId()\n+    {\n+        return $this->id;\n+    }\n+\n+    /**\n+     * @param string $facebookId\n+     * @return User\n+     */\n+    public function setFacebookId($facebookId)\n+    {\n+        $this->facebookId = $facebookId;\n+\n+        return $this;\n+    }\n+\n+    /**\n+     * @return string\n+     */\n+    public function getFacebookId()\n+    {\n+        return $this->facebookId;\n+    }\n+\n+    /**\n+     * @param string $facebookAccessToken\n+     * @return User\n+     */\n+    public function setFacebookAccessToken($facebookAccessToken)\n+    {\n+        $this->facebookAccessToken = $facebookAccessToken;\n+\n+        return $this;\n+    }\n+\n+    /**\n+     * @return string\n+     */\n+    public function getFacebookAccessToken()\n+    {\n+        return $this->facebookAccessToken;\n+    }\n+```\n+After adding extra properties to User entity, you need to extend base FOSUBUserProvider (if you want to add more advanced behavior, than provided from the box)","path":"Resources/doc/4-integrating_fosub.md","position":89,"original_position":89,"commit_id":"792b37fedc3971bc766898d363b5eaee6b21c80c","original_commit_id":"792b37fedc3971bc766898d363b5eaee6b21c80c","user":{"login":"weaverryan","id":121003,"avatar_url":"https://avatars.githubusercontent.com/u/121003?v=3","gravatar_id":"","url":"https://api.github.com/users/weaverryan","html_url":"https://github.com/weaverryan","followers_url":"https://api.github.com/users/weaverryan/followers","following_url":"https://api.github.com/users/weaverryan/following{/other_user}","gists_url":"https://api.github.com/users/weaverryan/gists{/gist_id}","starred_url":"https://api.github.com/users/weaverryan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weaverryan/subscriptions","organizations_url":"https://api.github.com/users/weaverryan/orgs","repos_url":"https://api.github.com/users/weaverryan/repos","events_url":"https://api.github.com/users/weaverryan/events{/privacy}","received_events_url":"https://api.github.com/users/weaverryan/received_events","type":"User","site_admin":false},"body":"It's not clear if I *must* extend `FOSUBUserProvider` or if that step is optional. In practice, it *seems* required to me (i.e. 99% of users should extend `FOSUBUserProvider`). If that is true, we should remove this sentence.","created_at":"2015-12-10T09:45:25Z","updated_at":"2015-12-10T09:45:25Z","html_url":"https://github.com/hwi/HWIOAuthBundle/pull/881#discussion_r47205859","pull_request_url":"https://api.github.com/repos/hwi/HWIOAuthBundle/pulls/881","_links":{"self":{"href":"https://api.github.com/repos/hwi/HWIOAuthBundle/pulls/comments/47205859"},"html":{"href":"https://github.com/hwi/HWIOAuthBundle/pull/881#discussion_r47205859"},"pull_request":{"href":"https://api.github.com/repos/hwi/HWIOAuthBundle/pulls/881"}}},"pull_request":{"url":"https://api.github.com/repos/hwi/HWIOAuthBundle/pulls/881","id":47361550,"html_url":"https://github.com/hwi/HWIOAuthBundle/pull/881","diff_url":"https://github.com/hwi/HWIOAuthBundle/pull/881.diff","patch_url":"https://github.com/hwi/HWIOAuthBundle/pull/881.patch","issue_url":"https://api.github.com/repos/hwi/HWIOAuthBundle/issues/881","number":881,"state":"open","locked":false,"title":"Add draft for FOSUB integration documentation","user":{"login":"NovikovViktor","id":8058373,"avatar_url":"https://avatars.githubusercontent.com/u/8058373?v=3","gravatar_id":"","url":"https://api.github.com/users/NovikovViktor","html_url":"https://github.com/NovikovViktor","followers_url":"https://api.github.com/users/NovikovViktor/followers","following_url":"https://api.github.com/users/NovikovViktor/following{/other_user}","gists_url":"https://api.github.com/users/NovikovViktor/gists{/gist_id}","starred_url":"https://api.github.com/users/NovikovViktor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NovikovViktor/subscriptions","organizations_url":"https://api.github.com/users/NovikovViktor/orgs","repos_url":"https://api.github.com/users/NovikovViktor/repos","events_url":"https://api.github.com/users/NovikovViktor/events{/privacy}","received_events_url":"https://api.github.com/users/NovikovViktor/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-10-11T07:02:08Z","updated_at":"2015-12-10T09:45:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ff23d472c7c087d5a3b234d4ff03aed93dc06238","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/hwi/HWIOAuthBundle/pulls/881/commits","review_comments_url":"https://api.github.com/repos/hwi/HWIOAuthBundle/pulls/881/comments","review_comment_url":"https://api.github.com/repos/hwi/HWIOAuthBundle/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hwi/HWIOAuthBundle/issues/881/comments","statuses_url":"https://api.github.com/repos/hwi/HWIOAuthBundle/statuses/792b37fedc3971bc766898d363b5eaee6b21c80c","head":{"label":"NovikovViktor:master","ref":"master","sha":"792b37fedc3971bc766898d363b5eaee6b21c80c","user":{"login":"NovikovViktor","id":8058373,"avatar_url":"https://avatars.githubusercontent.com/u/8058373?v=3","gravatar_id":"","url":"https://api.github.com/users/NovikovViktor","html_url":"https://github.com/NovikovViktor","followers_url":"https://api.github.com/users/NovikovViktor/followers","following_url":"https://api.github.com/users/NovikovViktor/following{/other_user}","gists_url":"https://api.github.com/users/NovikovViktor/gists{/gist_id}","starred_url":"https://api.github.com/users/NovikovViktor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NovikovViktor/subscriptions","organizations_url":"https://api.github.com/users/NovikovViktor/orgs","repos_url":"https://api.github.com/users/NovikovViktor/repos","events_url":"https://api.github.com/users/NovikovViktor/events{/privacy}","received_events_url":"https://api.github.com/users/NovikovViktor/received_events","type":"User","site_admin":false},"repo":{"id":33731432,"name":"HWIOAuthBundle","full_name":"NovikovViktor/HWIOAuthBundle","owner":{"login":"NovikovViktor","id":8058373,"avatar_url":"https://avatars.githubusercontent.com/u/8058373?v=3","gravatar_id":"","url":"https://api.github.com/users/NovikovViktor","html_url":"https://github.com/NovikovViktor","followers_url":"https://api.github.com/users/NovikovViktor/followers","following_url":"https://api.github.com/users/NovikovViktor/following{/other_user}","gists_url":"https://api.github.com/users/NovikovViktor/gists{/gist_id}","starred_url":"https://api.github.com/users/NovikovViktor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NovikovViktor/subscriptions","organizations_url":"https://api.github.com/users/NovikovViktor/orgs","repos_url":"https://api.github.com/users/NovikovViktor/repos","events_url":"https://api.github.com/users/NovikovViktor/events{/privacy}","received_events_url":"https://api.github.com/users/NovikovViktor/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/NovikovViktor/HWIOAuthBundle","description":"OAuth client integration for Symfony. Supports both OAuth1.0a and OAuth2.","fork":true,"url":"https://api.github.com/repos/NovikovViktor/HWIOAuthBundle","forks_url":"https://api.github.com/repos/NovikovViktor/HWIOAuthBundle/forks","keys_url":"https://api.github.com/repos/NovikovViktor/HWIOAuthBundle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NovikovViktor/HWIOAuthBundle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NovikovViktor/HWIOAuthBundle/teams","hooks_url":"https://api.github.com/repos/NovikovViktor/HWIOAuthBundle/hooks","issue_events_url":"https://api.github.com/repos/NovikovViktor/HWIOAuthBundle/issues/events{/number}","events_url":"https://api.github.com/repos/NovikovViktor/HWIOAuthBundle/events","assignees_url":"https://api.github.com/repos/NovikovViktor/HWIOAuthBundle/assignees{/user}","branches_url":"https://api.github.com/repos/NovikovViktor/HWIOAuthBundle/branches{/branch}","tags_url":"https://api.github.com/repos/NovikovViktor/HWIOAuthBundle/tags","blobs_url":"https://api.github.com/repos/NovikovViktor/HWIOAuthBundle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NovikovViktor/HWIOAuthBundle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NovikovViktor/HWIOAuthBundle/git/refs{/sha}","trees_url":"https://api.github.com/repos/NovikovViktor/HWIOAuthBundle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NovikovViktor/HWIOAuthBundle/statuses/{sha}","languages_url":"https://api.github.com/repos/NovikovViktor/HWIOAuthBundle/languages","stargazers_url":"https://api.github.com/repos/NovikovViktor/HWIOAuthBundle/stargazers","contributors_url":"https://api.github.com/repos/NovikovViktor/HWIOAuthBundle/contributors","subscribers_url":"https://api.github.com/repos/NovikovViktor/HWIOAuthBundle/subscribers","subscription_url":"https://api.github.com/repos/NovikovViktor/HWIOAuthBundle/subscription","commits_url":"https://api.github.com/repos/NovikovViktor/HWIOAuthBundle/commits{/sha}","git_commits_url":"https://api.github.com/repos/NovikovViktor/HWIOAuthBundle/git/commits{/sha}","comments_url":"https://api.github.com/repos/NovikovViktor/HWIOAuthBundle/comments{/number}","issue_comment_url":"https://api.github.com/repos/NovikovViktor/HWIOAuthBundle/issues/comments{/number}","contents_url":"https://api.github.com/repos/NovikovViktor/HWIOAuthBundle/contents/{+path}","compare_url":"https://api.github.com/repos/NovikovViktor/HWIOAuthBundle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NovikovViktor/HWIOAuthBundle/merges","archive_url":"https://api.github.com/repos/NovikovViktor/HWIOAuthBundle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NovikovViktor/HWIOAuthBundle/downloads","issues_url":"https://api.github.com/repos/NovikovViktor/HWIOAuthBundle/issues{/number}","pulls_url":"https://api.github.com/repos/NovikovViktor/HWIOAuthBundle/pulls{/number}","milestones_url":"https://api.github.com/repos/NovikovViktor/HWIOAuthBundle/milestones{/number}","notifications_url":"https://api.github.com/repos/NovikovViktor/HWIOAuthBundle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NovikovViktor/HWIOAuthBundle/labels{/name}","releases_url":"https://api.github.com/repos/NovikovViktor/HWIOAuthBundle/releases{/id}","created_at":"2015-04-10T14:00:49Z","updated_at":"2015-04-10T14:48:57Z","pushed_at":"2015-12-05T20:57:49Z","git_url":"git://github.com/NovikovViktor/HWIOAuthBundle.git","ssh_url":"git@github.com:NovikovViktor/HWIOAuthBundle.git","clone_url":"https://github.com/NovikovViktor/HWIOAuthBundle.git","svn_url":"https://github.com/NovikovViktor/HWIOAuthBundle","homepage":"","size":1715,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"hwi:master","ref":"master","sha":"7b26e8b87945f825bb5df29691ee72e12cf97894","user":{"login":"hwi","id":1150427,"avatar_url":"https://avatars.githubusercontent.com/u/1150427?v=3","gravatar_id":"","url":"https://api.github.com/users/hwi","html_url":"https://github.com/hwi","followers_url":"https://api.github.com/users/hwi/followers","following_url":"https://api.github.com/users/hwi/following{/other_user}","gists_url":"https://api.github.com/users/hwi/gists{/gist_id}","starred_url":"https://api.github.com/users/hwi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hwi/subscriptions","organizations_url":"https://api.github.com/users/hwi/orgs","repos_url":"https://api.github.com/users/hwi/repos","events_url":"https://api.github.com/users/hwi/events{/privacy}","received_events_url":"https://api.github.com/users/hwi/received_events","type":"Organization","site_admin":false},"repo":{"id":3601728,"name":"HWIOAuthBundle","full_name":"hwi/HWIOAuthBundle","owner":{"login":"hwi","id":1150427,"avatar_url":"https://avatars.githubusercontent.com/u/1150427?v=3","gravatar_id":"","url":"https://api.github.com/users/hwi","html_url":"https://github.com/hwi","followers_url":"https://api.github.com/users/hwi/followers","following_url":"https://api.github.com/users/hwi/following{/other_user}","gists_url":"https://api.github.com/users/hwi/gists{/gist_id}","starred_url":"https://api.github.com/users/hwi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hwi/subscriptions","organizations_url":"https://api.github.com/users/hwi/orgs","repos_url":"https://api.github.com/users/hwi/repos","events_url":"https://api.github.com/users/hwi/events{/privacy}","received_events_url":"https://api.github.com/users/hwi/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hwi/HWIOAuthBundle","description":"OAuth client integration for Symfony. Supports both OAuth1.0a and OAuth2.","fork":false,"url":"https://api.github.com/repos/hwi/HWIOAuthBundle","forks_url":"https://api.github.com/repos/hwi/HWIOAuthBundle/forks","keys_url":"https://api.github.com/repos/hwi/HWIOAuthBundle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hwi/HWIOAuthBundle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hwi/HWIOAuthBundle/teams","hooks_url":"https://api.github.com/repos/hwi/HWIOAuthBundle/hooks","issue_events_url":"https://api.github.com/repos/hwi/HWIOAuthBundle/issues/events{/number}","events_url":"https://api.github.com/repos/hwi/HWIOAuthBundle/events","assignees_url":"https://api.github.com/repos/hwi/HWIOAuthBundle/assignees{/user}","branches_url":"https://api.github.com/repos/hwi/HWIOAuthBundle/branches{/branch}","tags_url":"https://api.github.com/repos/hwi/HWIOAuthBundle/tags","blobs_url":"https://api.github.com/repos/hwi/HWIOAuthBundle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hwi/HWIOAuthBundle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hwi/HWIOAuthBundle/git/refs{/sha}","trees_url":"https://api.github.com/repos/hwi/HWIOAuthBundle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hwi/HWIOAuthBundle/statuses/{sha}","languages_url":"https://api.github.com/repos/hwi/HWIOAuthBundle/languages","stargazers_url":"https://api.github.com/repos/hwi/HWIOAuthBundle/stargazers","contributors_url":"https://api.github.com/repos/hwi/HWIOAuthBundle/contributors","subscribers_url":"https://api.github.com/repos/hwi/HWIOAuthBundle/subscribers","subscription_url":"https://api.github.com/repos/hwi/HWIOAuthBundle/subscription","commits_url":"https://api.github.com/repos/hwi/HWIOAuthBundle/commits{/sha}","git_commits_url":"https://api.github.com/repos/hwi/HWIOAuthBundle/git/commits{/sha}","comments_url":"https://api.github.com/repos/hwi/HWIOAuthBundle/comments{/number}","issue_comment_url":"https://api.github.com/repos/hwi/HWIOAuthBundle/issues/comments{/number}","contents_url":"https://api.github.com/repos/hwi/HWIOAuthBundle/contents/{+path}","compare_url":"https://api.github.com/repos/hwi/HWIOAuthBundle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hwi/HWIOAuthBundle/merges","archive_url":"https://api.github.com/repos/hwi/HWIOAuthBundle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hwi/HWIOAuthBundle/downloads","issues_url":"https://api.github.com/repos/hwi/HWIOAuthBundle/issues{/number}","pulls_url":"https://api.github.com/repos/hwi/HWIOAuthBundle/pulls{/number}","milestones_url":"https://api.github.com/repos/hwi/HWIOAuthBundle/milestones{/number}","notifications_url":"https://api.github.com/repos/hwi/HWIOAuthBundle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hwi/HWIOAuthBundle/labels{/name}","releases_url":"https://api.github.com/repos/hwi/HWIOAuthBundle/releases{/id}","created_at":"2012-03-02T11:56:40Z","updated_at":"2015-12-09T22:47:02Z","pushed_at":"2015-12-09T02:11:41Z","git_url":"git://github.com/hwi/HWIOAuthBundle.git","ssh_url":"git@github.com:hwi/HWIOAuthBundle.git","clone_url":"https://github.com/hwi/HWIOAuthBundle.git","svn_url":"https://github.com/hwi/HWIOAuthBundle","homepage":"","size":2844,"stargazers_count":1055,"watchers_count":1055,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":443,"mirror_url":null,"open_issues_count":177,"forks":443,"open_issues":177,"watchers":1055,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hwi/HWIOAuthBundle/pulls/881"},"html":{"href":"https://github.com/hwi/HWIOAuthBundle/pull/881"},"issue":{"href":"https://api.github.com/repos/hwi/HWIOAuthBundle/issues/881"},"comments":{"href":"https://api.github.com/repos/hwi/HWIOAuthBundle/issues/881/comments"},"review_comments":{"href":"https://api.github.com/repos/hwi/HWIOAuthBundle/pulls/881/comments"},"review_comment":{"href":"https://api.github.com/repos/hwi/HWIOAuthBundle/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hwi/HWIOAuthBundle/pulls/881/commits"},"statuses":{"href":"https://api.github.com/repos/hwi/HWIOAuthBundle/statuses/792b37fedc3971bc766898d363b5eaee6b21c80c"}}}}