{"action":"created","comment":{"url":"https://api.github.com/repos/sebAvenel/mon_blog/pulls/comments/258651262","pull_request_review_id":205964802,"id":258651262,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI1ODY1MTI2Mg==","diff_hunk":"@@ -0,0 +1,52 @@\n+<?php\n+\n+namespace App\\src\\DAO;\n+\n+use App\\src\\model\\Comment;\n+\n+\n+class CommentsDAO extends DAO\n+{\n+    public function getCommentsFromBlogPost($idBlogPost){\n+\n+        $sql = 'SELECT id, content, createdAt, DATE_FORMAT(updatedAt, \"%d/%m/%Y à %H:%i:%s\") AS updatedAt, isValid, idBlogPost, idUser\n+                FROM comment \n+                WHERE comment.idBlogPost = ?';\n+        $result = $this->sql($sql, [$idBlogPost]);\n+        $comments = [];\n+        while ($data = $result->fetch()){\n+            $commentId = $data['id'];\n+            $comments[$commentId] = $this->buildObjectComment($data);\n+        }\n+        return $comments;\n+\n+    }\n+\n+    public function getCommentsFromBlogPostWithUser($idBlogPost){\n+        $sql = 'SELECT comment.id, comment.content, comment.createdAt, DATE_FORMAT(comment.updatedAt, \"%d/%m/%Y à %H:%i:%s\") AS updatedAt, comment.isValid, comment.idBlogPost, comment.idUser, user.id AS userId, user.name\n+                FROM comment \n+                INNER JOIN user\n+                  ON comment.idUser = user.id\n+                WHERE comment.idBlogPost = ?\n+                AND comment.isValid = 1';\n+        $result = $this->sql($sql, [$idBlogPost]);\n+        $tab = [];\n+        foreach ($result as $key => $value){\n+            $tab[$key] = $value;\n+        }\n+        return $tab;\n+    }\n+\n+    private function buildObjectComment(array $row){\n+\n+        $comment = new Comment();\n+        $comment->setId($row['id']);\n+        $comment->setContent($row['content']);\n+        $comment->setCreatedAt($row['createdAt']);\n+        $comment->setUpdatedAt($row['updatedAt']);\n+        $comment->setIsValid($row['isValid']);\n+        $comment->setIdBlogPost($row['idBlogPost']);\n+        $comment->setIdUser($row['idUser']);\n+        return $comment;","path":"App/src/DAO/CommentsDAO.php","position":50,"original_position":50,"commit_id":"f01d4121c178c14de2972132f1ee0eac6ea18a32","original_commit_id":"f01d4121c178c14de2972132f1ee0eac6ea18a32","user":{"login":"XenoX","id":1884209,"node_id":"MDQ6VXNlcjE4ODQyMDk=","avatar_url":"https://avatars1.githubusercontent.com/u/1884209?v=4","gravatar_id":"","url":"https://api.github.com/users/XenoX","html_url":"https://github.com/XenoX","followers_url":"https://api.github.com/users/XenoX/followers","following_url":"https://api.github.com/users/XenoX/following{/other_user}","gists_url":"https://api.github.com/users/XenoX/gists{/gist_id}","starred_url":"https://api.github.com/users/XenoX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/XenoX/subscriptions","organizations_url":"https://api.github.com/users/XenoX/orgs","repos_url":"https://api.github.com/users/XenoX/repos","events_url":"https://api.github.com/users/XenoX/events{/privacy}","received_events_url":"https://api.github.com/users/XenoX/received_events","type":"User","site_admin":false},"body":"ligne vide avant un return","created_at":"2019-02-20T19:55:32Z","updated_at":"2019-02-20T19:57:23Z","html_url":"https://github.com/sebAvenel/mon_blog/pull/27#discussion_r258651262","pull_request_url":"https://api.github.com/repos/sebAvenel/mon_blog/pulls/27","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/sebAvenel/mon_blog/pulls/comments/258651262"},"html":{"href":"https://github.com/sebAvenel/mon_blog/pull/27#discussion_r258651262"},"pull_request":{"href":"https://api.github.com/repos/sebAvenel/mon_blog/pulls/27"}}},"pull_request":{"url":"https://api.github.com/repos/sebAvenel/mon_blog/pulls/27","id":252447175,"node_id":"MDExOlB1bGxSZXF1ZXN0MjUyNDQ3MTc1","html_url":"https://github.com/sebAvenel/mon_blog/pull/27","diff_url":"https://github.com/sebAvenel/mon_blog/pull/27.diff","patch_url":"https://github.com/sebAvenel/mon_blog/pull/27.patch","issue_url":"https://api.github.com/repos/sebAvenel/mon_blog/issues/27","number":27,"state":"open","locked":false,"title":"Contact form","user":{"login":"sebAvenel","id":46401446,"node_id":"MDQ6VXNlcjQ2NDAxNDQ2","avatar_url":"https://avatars1.githubusercontent.com/u/46401446?v=4","gravatar_id":"","url":"https://api.github.com/users/sebAvenel","html_url":"https://github.com/sebAvenel","followers_url":"https://api.github.com/users/sebAvenel/followers","following_url":"https://api.github.com/users/sebAvenel/following{/other_user}","gists_url":"https://api.github.com/users/sebAvenel/gists{/gist_id}","starred_url":"https://api.github.com/users/sebAvenel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sebAvenel/subscriptions","organizations_url":"https://api.github.com/users/sebAvenel/orgs","repos_url":"https://api.github.com/users/sebAvenel/repos","events_url":"https://api.github.com/users/sebAvenel/events{/privacy}","received_events_url":"https://api.github.com/users/sebAvenel/received_events","type":"User","site_admin":false},"body":"Creation of the contact form and display of the name of the user who posted a comment.","created_at":"2019-02-12T19:45:58Z","updated_at":"2019-02-20T19:57:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"663363f16b3bfe62388cb0f29e0843e6fcbc7b3f","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/sebAvenel/mon_blog/pulls/27/commits","review_comments_url":"https://api.github.com/repos/sebAvenel/mon_blog/pulls/27/comments","review_comment_url":"https://api.github.com/repos/sebAvenel/mon_blog/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sebAvenel/mon_blog/issues/27/comments","statuses_url":"https://api.github.com/repos/sebAvenel/mon_blog/statuses/f01d4121c178c14de2972132f1ee0eac6ea18a32","head":{"label":"sebAvenel:contact_form","ref":"contact_form","sha":"f01d4121c178c14de2972132f1ee0eac6ea18a32","user":{"login":"sebAvenel","id":46401446,"node_id":"MDQ6VXNlcjQ2NDAxNDQ2","avatar_url":"https://avatars1.githubusercontent.com/u/46401446?v=4","gravatar_id":"","url":"https://api.github.com/users/sebAvenel","html_url":"https://github.com/sebAvenel","followers_url":"https://api.github.com/users/sebAvenel/followers","following_url":"https://api.github.com/users/sebAvenel/following{/other_user}","gists_url":"https://api.github.com/users/sebAvenel/gists{/gist_id}","starred_url":"https://api.github.com/users/sebAvenel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sebAvenel/subscriptions","organizations_url":"https://api.github.com/users/sebAvenel/orgs","repos_url":"https://api.github.com/users/sebAvenel/repos","events_url":"https://api.github.com/users/sebAvenel/events{/privacy}","received_events_url":"https://api.github.com/users/sebAvenel/received_events","type":"User","site_admin":false},"repo":{"id":165610047,"node_id":"MDEwOlJlcG9zaXRvcnkxNjU2MTAwNDc=","name":"mon_blog","full_name":"sebAvenel/mon_blog","private":false,"owner":{"login":"sebAvenel","id":46401446,"node_id":"MDQ6VXNlcjQ2NDAxNDQ2","avatar_url":"https://avatars1.githubusercontent.com/u/46401446?v=4","gravatar_id":"","url":"https://api.github.com/users/sebAvenel","html_url":"https://github.com/sebAvenel","followers_url":"https://api.github.com/users/sebAvenel/followers","following_url":"https://api.github.com/users/sebAvenel/following{/other_user}","gists_url":"https://api.github.com/users/sebAvenel/gists{/gist_id}","starred_url":"https://api.github.com/users/sebAvenel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sebAvenel/subscriptions","organizations_url":"https://api.github.com/users/sebAvenel/orgs","repos_url":"https://api.github.com/users/sebAvenel/repos","events_url":"https://api.github.com/users/sebAvenel/events{/privacy}","received_events_url":"https://api.github.com/users/sebAvenel/received_events","type":"User","site_admin":false},"html_url":"https://github.com/sebAvenel/mon_blog","description":"Projet numéro 5 de ma formation PHP/Symfony chez Openclassrooms qui consiste à créer un blog en POO avec architecture MVC.","fork":false,"url":"https://api.github.com/repos/sebAvenel/mon_blog","forks_url":"https://api.github.com/repos/sebAvenel/mon_blog/forks","keys_url":"https://api.github.com/repos/sebAvenel/mon_blog/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sebAvenel/mon_blog/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sebAvenel/mon_blog/teams","hooks_url":"https://api.github.com/repos/sebAvenel/mon_blog/hooks","issue_events_url":"https://api.github.com/repos/sebAvenel/mon_blog/issues/events{/number}","events_url":"https://api.github.com/repos/sebAvenel/mon_blog/events","assignees_url":"https://api.github.com/repos/sebAvenel/mon_blog/assignees{/user}","branches_url":"https://api.github.com/repos/sebAvenel/mon_blog/branches{/branch}","tags_url":"https://api.github.com/repos/sebAvenel/mon_blog/tags","blobs_url":"https://api.github.com/repos/sebAvenel/mon_blog/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sebAvenel/mon_blog/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sebAvenel/mon_blog/git/refs{/sha}","trees_url":"https://api.github.com/repos/sebAvenel/mon_blog/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sebAvenel/mon_blog/statuses/{sha}","languages_url":"https://api.github.com/repos/sebAvenel/mon_blog/languages","stargazers_url":"https://api.github.com/repos/sebAvenel/mon_blog/stargazers","contributors_url":"https://api.github.com/repos/sebAvenel/mon_blog/contributors","subscribers_url":"https://api.github.com/repos/sebAvenel/mon_blog/subscribers","subscription_url":"https://api.github.com/repos/sebAvenel/mon_blog/subscription","commits_url":"https://api.github.com/repos/sebAvenel/mon_blog/commits{/sha}","git_commits_url":"https://api.github.com/repos/sebAvenel/mon_blog/git/commits{/sha}","comments_url":"https://api.github.com/repos/sebAvenel/mon_blog/comments{/number}","issue_comment_url":"https://api.github.com/repos/sebAvenel/mon_blog/issues/comments{/number}","contents_url":"https://api.github.com/repos/sebAvenel/mon_blog/contents/{+path}","compare_url":"https://api.github.com/repos/sebAvenel/mon_blog/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sebAvenel/mon_blog/merges","archive_url":"https://api.github.com/repos/sebAvenel/mon_blog/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sebAvenel/mon_blog/downloads","issues_url":"https://api.github.com/repos/sebAvenel/mon_blog/issues{/number}","pulls_url":"https://api.github.com/repos/sebAvenel/mon_blog/pulls{/number}","milestones_url":"https://api.github.com/repos/sebAvenel/mon_blog/milestones{/number}","notifications_url":"https://api.github.com/repos/sebAvenel/mon_blog/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sebAvenel/mon_blog/labels{/name}","releases_url":"https://api.github.com/repos/sebAvenel/mon_blog/releases{/id}","deployments_url":"https://api.github.com/repos/sebAvenel/mon_blog/deployments","created_at":"2019-01-14T06:48:53Z","updated_at":"2019-02-20T19:36:40Z","pushed_at":"2019-02-20T19:36:38Z","git_url":"git://github.com/sebAvenel/mon_blog.git","ssh_url":"git@github.com:sebAvenel/mon_blog.git","clone_url":"https://github.com/sebAvenel/mon_blog.git","svn_url":"https://github.com/sebAvenel/mon_blog","homepage":null,"size":3284,"stargazers_count":0,"watchers_count":0,"language":"CSS","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":6,"license":null,"forks":0,"open_issues":6,"watchers":0,"default_branch":"master"}},"base":{"label":"sebAvenel:master","ref":"master","sha":"f35938d2d0b00253e06df6a45b77a7bc582bc67c","user":{"login":"sebAvenel","id":46401446,"node_id":"MDQ6VXNlcjQ2NDAxNDQ2","avatar_url":"https://avatars1.githubusercontent.com/u/46401446?v=4","gravatar_id":"","url":"https://api.github.com/users/sebAvenel","html_url":"https://github.com/sebAvenel","followers_url":"https://api.github.com/users/sebAvenel/followers","following_url":"https://api.github.com/users/sebAvenel/following{/other_user}","gists_url":"https://api.github.com/users/sebAvenel/gists{/gist_id}","starred_url":"https://api.github.com/users/sebAvenel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sebAvenel/subscriptions","organizations_url":"https://api.github.com/users/sebAvenel/orgs","repos_url":"https://api.github.com/users/sebAvenel/repos","events_url":"https://api.github.com/users/sebAvenel/events{/privacy}","received_events_url":"https://api.github.com/users/sebAvenel/received_events","type":"User","site_admin":false},"repo":{"id":165610047,"node_id":"MDEwOlJlcG9zaXRvcnkxNjU2MTAwNDc=","name":"mon_blog","full_name":"sebAvenel/mon_blog","private":false,"owner":{"login":"sebAvenel","id":46401446,"node_id":"MDQ6VXNlcjQ2NDAxNDQ2","avatar_url":"https://avatars1.githubusercontent.com/u/46401446?v=4","gravatar_id":"","url":"https://api.github.com/users/sebAvenel","html_url":"https://github.com/sebAvenel","followers_url":"https://api.github.com/users/sebAvenel/followers","following_url":"https://api.github.com/users/sebAvenel/following{/other_user}","gists_url":"https://api.github.com/users/sebAvenel/gists{/gist_id}","starred_url":"https://api.github.com/users/sebAvenel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sebAvenel/subscriptions","organizations_url":"https://api.github.com/users/sebAvenel/orgs","repos_url":"https://api.github.com/users/sebAvenel/repos","events_url":"https://api.github.com/users/sebAvenel/events{/privacy}","received_events_url":"https://api.github.com/users/sebAvenel/received_events","type":"User","site_admin":false},"html_url":"https://github.com/sebAvenel/mon_blog","description":"Projet numéro 5 de ma formation PHP/Symfony chez Openclassrooms qui consiste à créer un blog en POO avec architecture MVC.","fork":false,"url":"https://api.github.com/repos/sebAvenel/mon_blog","forks_url":"https://api.github.com/repos/sebAvenel/mon_blog/forks","keys_url":"https://api.github.com/repos/sebAvenel/mon_blog/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sebAvenel/mon_blog/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sebAvenel/mon_blog/teams","hooks_url":"https://api.github.com/repos/sebAvenel/mon_blog/hooks","issue_events_url":"https://api.github.com/repos/sebAvenel/mon_blog/issues/events{/number}","events_url":"https://api.github.com/repos/sebAvenel/mon_blog/events","assignees_url":"https://api.github.com/repos/sebAvenel/mon_blog/assignees{/user}","branches_url":"https://api.github.com/repos/sebAvenel/mon_blog/branches{/branch}","tags_url":"https://api.github.com/repos/sebAvenel/mon_blog/tags","blobs_url":"https://api.github.com/repos/sebAvenel/mon_blog/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sebAvenel/mon_blog/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sebAvenel/mon_blog/git/refs{/sha}","trees_url":"https://api.github.com/repos/sebAvenel/mon_blog/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sebAvenel/mon_blog/statuses/{sha}","languages_url":"https://api.github.com/repos/sebAvenel/mon_blog/languages","stargazers_url":"https://api.github.com/repos/sebAvenel/mon_blog/stargazers","contributors_url":"https://api.github.com/repos/sebAvenel/mon_blog/contributors","subscribers_url":"https://api.github.com/repos/sebAvenel/mon_blog/subscribers","subscription_url":"https://api.github.com/repos/sebAvenel/mon_blog/subscription","commits_url":"https://api.github.com/repos/sebAvenel/mon_blog/commits{/sha}","git_commits_url":"https://api.github.com/repos/sebAvenel/mon_blog/git/commits{/sha}","comments_url":"https://api.github.com/repos/sebAvenel/mon_blog/comments{/number}","issue_comment_url":"https://api.github.com/repos/sebAvenel/mon_blog/issues/comments{/number}","contents_url":"https://api.github.com/repos/sebAvenel/mon_blog/contents/{+path}","compare_url":"https://api.github.com/repos/sebAvenel/mon_blog/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sebAvenel/mon_blog/merges","archive_url":"https://api.github.com/repos/sebAvenel/mon_blog/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sebAvenel/mon_blog/downloads","issues_url":"https://api.github.com/repos/sebAvenel/mon_blog/issues{/number}","pulls_url":"https://api.github.com/repos/sebAvenel/mon_blog/pulls{/number}","milestones_url":"https://api.github.com/repos/sebAvenel/mon_blog/milestones{/number}","notifications_url":"https://api.github.com/repos/sebAvenel/mon_blog/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sebAvenel/mon_blog/labels{/name}","releases_url":"https://api.github.com/repos/sebAvenel/mon_blog/releases{/id}","deployments_url":"https://api.github.com/repos/sebAvenel/mon_blog/deployments","created_at":"2019-01-14T06:48:53Z","updated_at":"2019-02-20T19:36:40Z","pushed_at":"2019-02-20T19:36:38Z","git_url":"git://github.com/sebAvenel/mon_blog.git","ssh_url":"git@github.com:sebAvenel/mon_blog.git","clone_url":"https://github.com/sebAvenel/mon_blog.git","svn_url":"https://github.com/sebAvenel/mon_blog","homepage":null,"size":3284,"stargazers_count":0,"watchers_count":0,"language":"CSS","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":6,"license":null,"forks":0,"open_issues":6,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sebAvenel/mon_blog/pulls/27"},"html":{"href":"https://github.com/sebAvenel/mon_blog/pull/27"},"issue":{"href":"https://api.github.com/repos/sebAvenel/mon_blog/issues/27"},"comments":{"href":"https://api.github.com/repos/sebAvenel/mon_blog/issues/27/comments"},"review_comments":{"href":"https://api.github.com/repos/sebAvenel/mon_blog/pulls/27/comments"},"review_comment":{"href":"https://api.github.com/repos/sebAvenel/mon_blog/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sebAvenel/mon_blog/pulls/27/commits"},"statuses":{"href":"https://api.github.com/repos/sebAvenel/mon_blog/statuses/f01d4121c178c14de2972132f1ee0eac6ea18a32"}},"author_association":"OWNER"}}
{"actor":{"display_login":"XenoX"}}