GitHub PullRequestReviewCommentEvent at 2014-06-08 11:38:52
Repository: server
Actor: trecouvr
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/payutc/server/pulls/comments/13523790","id":13523790,"diff_hunk":"@@ -0,0 +1,73 @@\n+<?php\n+\n+/**\n+ * Task.class\n+ * \n+ * Gestion des tâches à effectuer hors des requêtes web\n+ * Table: t_task_tas\n+ */\n+\n+namespace Payutc\\Bom;\n+use \\Payutc\\Db\\Dbal;\n+use \\Payutc\\Exception\\NotImplemented;\n+\n+class Task {\n+    public static function addNotification($message, $user) {\n+        Dbal::conn()->insert('t_task_tas',\n+            array('tas_message' => $message,\n+                  'tas_user' => $user->getId(),\n+                  'tas_type' => 'notification',\n+                  'tas_created_at' => new \\DateTime('now')),\n+            array('string', 'integer', 'string', 'datetime'));\n+    }\n+    \n+    /**\n+     * Exécute la plus vieille requête présente dans la table puis la supprime\n+     * Cette méthode ne doit pas être appelée plusieurs fois simultanement au \n+     *  risque de traiter plusieurs fois une une tâche\n+     * renvoie une exception en cas de problème\n+     * true si une tâche à été traitée\n+     * false il n'y a plus de tâches à traiter\n+     */\n+    public static function doOne() {\n+        $conn = Dbal::conn();\n+        $conn->beginTransaction();\n+        \n+        $qb = $conn->createQueryBuilder()\n+            ->select('tas_id', 'tas_message', 'tas_user', 'tas_type')\n+            ->from('t_task_tas', 't')\n+            ->orderBy('tas_id', 'ASC')\n+            ->setMaxResults(1);\n+        $query = $qb->execute();\n+        \n+        if ($query->rowCount() == 0) {\n+            return false;\n+        }\n+\n+        try {\n+            $data = $query->fetch();\n+            if ($data['tas_type'] == 'notification') {\n+                Notification::send($data['tas_user'], $data['tas_message']);\n+            } else {\n+                throw new NotImplement(\"Task type : \" . $data['tas_type']);\n+            }\n+        } catch (\\Exception $e) {\n+            $qdelete = $conn->createQueryBuilder()\n+                ->delete('t_task_tas')","path":"src/Payutc/Bom/Task.php","position":56,"original_position":56,"commit_id":"69e5c3ed086d1952a78de8370618f56e521e5d75","original_commit_id":"69e5c3ed086d1952a78de8370618f56e521e5d75","user":{"login":"trecouvr","id":409916,"avatar_url":"https://avatars.githubusercontent.com/u/409916?","gravatar_id":"a39b9cbdc04079b6664452beb750601d","url":"https://api.github.com/users/trecouvr","html_url":"https://github.com/trecouvr","followers_url":"https://api.github.com/users/trecouvr/followers","following_url":"https://api.github.com/users/trecouvr/following{/other_user}","gists_url":"https://api.github.com/users/trecouvr/gists{/gist_id}","starred_url":"https://api.github.com/users/trecouvr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trecouvr/subscriptions","organizations_url":"https://api.github.com/users/trecouvr/orgs","repos_url":"https://api.github.com/users/trecouvr/repos","events_url":"https://api.github.com/users/trecouvr/events{/privacy}","received_events_url":"https://api.github.com/users/trecouvr/received_events","type":"User","site_admin":false},"body":"Faudrait un petit log, de plus tu catch tous les types d'exceptions dans le meme block, si c'est une exception de la db il faut faire un rollback.","created_at":"2014-06-08T11:38:52Z","updated_at":"2014-06-08T11:38:52Z","html_url":"https://github.com/payutc/server/pull/356#discussion_r13523790","pull_request_url":"https://api.github.com/repos/payutc/server/pulls/356","_links":{"self":{"href":"https://api.github.com/repos/payutc/server/pulls/comments/13523790"},"html":{"href":"https://github.com/payutc/server/pull/356#discussion_r13523790"},"pull_request":{"href":"https://api.github.com/repos/payutc/server/pulls/356"}}},"pull_request":{"url":"https://api.github.com/repos/payutc/server/pulls/356","id":16860734,"html_url":"https://github.com/payutc/server/pull/356","diff_url":"https://github.com/payutc/server/pull/356.diff","patch_url":"https://github.com/payutc/server/pull/356.patch","issue_url":"https://api.github.com/repos/payutc/server/issues/356","number":356,"state":"closed","title":"Tasks et notifications android ","user":{"login":"feuloren","id":1497071,"avatar_url":"https://avatars.githubusercontent.com/u/1497071?","gravatar_id":"2e0ba3ed13eea666b831a6e7fd21c5fe","url":"https://api.github.com/users/feuloren","html_url":"https://github.com/feuloren","followers_url":"https://api.github.com/users/feuloren/followers","following_url":"https://api.github.com/users/feuloren/following{/other_user}","gists_url":"https://api.github.com/users/feuloren/gists{/gist_id}","starred_url":"https://api.github.com/users/feuloren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/feuloren/subscriptions","organizations_url":"https://api.github.com/users/feuloren/orgs","repos_url":"https://api.github.com/users/feuloren/repos","events_url":"https://api.github.com/users/feuloren/events{/privacy}","received_events_url":"https://api.github.com/users/feuloren/received_events","type":"User","site_admin":false},"body":"","created_at":"2014-06-08T06:28:02Z","updated_at":"2014-06-08T11:38:52Z","closed_at":"2014-06-08T06:32:51Z","merged_at":"2014-06-08T06:32:51Z","merge_commit_sha":"f388e85abf705eb90780572edc6fb4490d0ae6a3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/payutc/server/pulls/356/commits","review_comments_url":"https://api.github.com/repos/payutc/server/pulls/356/comments","review_comment_url":"https://api.github.com/repos/payutc/server/pulls/comments/{number}","comments_url":"https://api.github.com/repos/payutc/server/issues/356/comments","statuses_url":"https://api.github.com/repos/payutc/server/statuses/69e5c3ed086d1952a78de8370618f56e521e5d75","head":{"label":"feuloren:tasks","ref":"tasks","sha":"69e5c3ed086d1952a78de8370618f56e521e5d75","user":{"login":"feuloren","id":1497071,"avatar_url":"https://avatars.githubusercontent.com/u/1497071?","gravatar_id":"2e0ba3ed13eea666b831a6e7fd21c5fe","url":"https://api.github.com/users/feuloren","html_url":"https://github.com/feuloren","followers_url":"https://api.github.com/users/feuloren/followers","following_url":"https://api.github.com/users/feuloren/following{/other_user}","gists_url":"https://api.github.com/users/feuloren/gists{/gist_id}","starred_url":"https://api.github.com/users/feuloren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/feuloren/subscriptions","organizations_url":"https://api.github.com/users/feuloren/orgs","repos_url":"https://api.github.com/users/feuloren/repos","events_url":"https://api.github.com/users/feuloren/events{/privacy}","received_events_url":"https://api.github.com/users/feuloren/received_events","type":"User","site_admin":false},"repo":{"id":9087771,"name":"server","full_name":"feuloren/server","owner":{"login":"feuloren","id":1497071,"avatar_url":"https://avatars.githubusercontent.com/u/1497071?","gravatar_id":"2e0ba3ed13eea666b831a6e7fd21c5fe","url":"https://api.github.com/users/feuloren","html_url":"https://github.com/feuloren","followers_url":"https://api.github.com/users/feuloren/followers","following_url":"https://api.github.com/users/feuloren/following{/other_user}","gists_url":"https://api.github.com/users/feuloren/gists{/gist_id}","starred_url":"https://api.github.com/users/feuloren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/feuloren/subscriptions","organizations_url":"https://api.github.com/users/feuloren/orgs","repos_url":"https://api.github.com/users/feuloren/repos","events_url":"https://api.github.com/users/feuloren/events{/privacy}","received_events_url":"https://api.github.com/users/feuloren/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/feuloren/server","description":"Serveur utilisé pour payutc","fork":true,"url":"https://api.github.com/repos/feuloren/server","forks_url":"https://api.github.com/repos/feuloren/server/forks","keys_url":"https://api.github.com/repos/feuloren/server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/feuloren/server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/feuloren/server/teams","hooks_url":"https://api.github.com/repos/feuloren/server/hooks","issue_events_url":"https://api.github.com/repos/feuloren/server/issues/events{/number}","events_url":"https://api.github.com/repos/feuloren/server/events","assignees_url":"https://api.github.com/repos/feuloren/server/assignees{/user}","branches_url":"https://api.github.com/repos/feuloren/server/branches{/branch}","tags_url":"https://api.github.com/repos/feuloren/server/tags","blobs_url":"https://api.github.com/repos/feuloren/server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/feuloren/server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/feuloren/server/git/refs{/sha}","trees_url":"https://api.github.com/repos/feuloren/server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/feuloren/server/statuses/{sha}","languages_url":"https://api.github.com/repos/feuloren/server/languages","stargazers_url":"https://api.github.com/repos/feuloren/server/stargazers","contributors_url":"https://api.github.com/repos/feuloren/server/contributors","subscribers_url":"https://api.github.com/repos/feuloren/server/subscribers","subscription_url":"https://api.github.com/repos/feuloren/server/subscription","commits_url":"https://api.github.com/repos/feuloren/server/commits{/sha}","git_commits_url":"https://api.github.com/repos/feuloren/server/git/commits{/sha}","comments_url":"https://api.github.com/repos/feuloren/server/comments{/number}","issue_comment_url":"https://api.github.com/repos/feuloren/server/issues/comments/{number}","contents_url":"https://api.github.com/repos/feuloren/server/contents/{+path}","compare_url":"https://api.github.com/repos/feuloren/server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/feuloren/server/merges","archive_url":"https://api.github.com/repos/feuloren/server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/feuloren/server/downloads","issues_url":"https://api.github.com/repos/feuloren/server/issues{/number}","pulls_url":"https://api.github.com/repos/feuloren/server/pulls{/number}","milestones_url":"https://api.github.com/repos/feuloren/server/milestones{/number}","notifications_url":"https://api.github.com/repos/feuloren/server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/feuloren/server/labels{/name}","releases_url":"https://api.github.com/repos/feuloren/server/releases{/id}","created_at":"2013-03-28T22:30:29Z","updated_at":"2014-06-08T06:32:51Z","pushed_at":"2014-06-08T06:27:17Z","git_url":"git://github.com/feuloren/server.git","ssh_url":"git@github.com:feuloren/server.git","clone_url":"https://github.com/feuloren/server.git","svn_url":"https://github.com/feuloren/server","homepage":"","size":6367,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"payutc:master","ref":"master","sha":"4c88760028c1e88bc20c8e69049dca22f9a6e932","user":{"login":"payutc","id":1557665,"avatar_url":"https://avatars.githubusercontent.com/u/1557665?","gravatar_id":"066a090520c3374faa363e8907bec42b","url":"https://api.github.com/users/payutc","html_url":"https://github.com/payutc","followers_url":"https://api.github.com/users/payutc/followers","following_url":"https://api.github.com/users/payutc/following{/other_user}","gists_url":"https://api.github.com/users/payutc/gists{/gist_id}","starred_url":"https://api.github.com/users/payutc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/payutc/subscriptions","organizations_url":"https://api.github.com/users/payutc/orgs","repos_url":"https://api.github.com/users/payutc/repos","events_url":"https://api.github.com/users/payutc/events{/privacy}","received_events_url":"https://api.github.com/users/payutc/received_events","type":"Organization","site_admin":false},"repo":{"id":4609721,"name":"server","full_name":"payutc/server","owner":{"login":"payutc","id":1557665,"avatar_url":"https://avatars.githubusercontent.com/u/1557665?","gravatar_id":"066a090520c3374faa363e8907bec42b","url":"https://api.github.com/users/payutc","html_url":"https://github.com/payutc","followers_url":"https://api.github.com/users/payutc/followers","following_url":"https://api.github.com/users/payutc/following{/other_user}","gists_url":"https://api.github.com/users/payutc/gists{/gist_id}","starred_url":"https://api.github.com/users/payutc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/payutc/subscriptions","organizations_url":"https://api.github.com/users/payutc/orgs","repos_url":"https://api.github.com/users/payutc/repos","events_url":"https://api.github.com/users/payutc/events{/privacy}","received_events_url":"https://api.github.com/users/payutc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/payutc/server","description":"Web Service exposant l'ensemble des opérations de payutc","fork":false,"url":"https://api.github.com/repos/payutc/server","forks_url":"https://api.github.com/repos/payutc/server/forks","keys_url":"https://api.github.com/repos/payutc/server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/payutc/server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/payutc/server/teams","hooks_url":"https://api.github.com/repos/payutc/server/hooks","issue_events_url":"https://api.github.com/repos/payutc/server/issues/events{/number}","events_url":"https://api.github.com/repos/payutc/server/events","assignees_url":"https://api.github.com/repos/payutc/server/assignees{/user}","branches_url":"https://api.github.com/repos/payutc/server/branches{/branch}","tags_url":"https://api.github.com/repos/payutc/server/tags","blobs_url":"https://api.github.com/repos/payutc/server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/payutc/server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/payutc/server/git/refs{/sha}","trees_url":"https://api.github.com/repos/payutc/server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/payutc/server/statuses/{sha}","languages_url":"https://api.github.com/repos/payutc/server/languages","stargazers_url":"https://api.github.com/repos/payutc/server/stargazers","contributors_url":"https://api.github.com/repos/payutc/server/contributors","subscribers_url":"https://api.github.com/repos/payutc/server/subscribers","subscription_url":"https://api.github.com/repos/payutc/server/subscription","commits_url":"https://api.github.com/repos/payutc/server/commits{/sha}","git_commits_url":"https://api.github.com/repos/payutc/server/git/commits{/sha}","comments_url":"https://api.github.com/repos/payutc/server/comments{/number}","issue_comment_url":"https://api.github.com/repos/payutc/server/issues/comments/{number}","contents_url":"https://api.github.com/repos/payutc/server/contents/{+path}","compare_url":"https://api.github.com/repos/payutc/server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/payutc/server/merges","archive_url":"https://api.github.com/repos/payutc/server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/payutc/server/downloads","issues_url":"https://api.github.com/repos/payutc/server/issues{/number}","pulls_url":"https://api.github.com/repos/payutc/server/pulls{/number}","milestones_url":"https://api.github.com/repos/payutc/server/milestones{/number}","notifications_url":"https://api.github.com/repos/payutc/server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/payutc/server/labels{/name}","releases_url":"https://api.github.com/repos/payutc/server/releases{/id}","created_at":"2012-06-09T19:18:32Z","updated_at":"2014-06-08T07:25:18Z","pushed_at":"2014-06-08T07:25:17Z","git_url":"git://github.com/payutc/server.git","ssh_url":"git@github.com:payutc/server.git","clone_url":"https://github.com/payutc/server.git","svn_url":"https://github.com/payutc/server","homepage":"","size":10397,"stargazers_count":8,"watchers_count":8,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":16,"mirror_url":null,"open_issues_count":46,"forks":16,"open_issues":46,"watchers":8,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/payutc/server/pulls/356"},"html":{"href":"https://github.com/payutc/server/pull/356"},"issue":{"href":"https://api.github.com/repos/payutc/server/issues/356"},"comments":{"href":"https://api.github.com/repos/payutc/server/issues/356/comments"},"review_comments":{"href":"https://api.github.com/repos/payutc/server/pulls/356/comments"},"review_comment":{"href":"https://api.github.com/repos/payutc/server/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/payutc/server/pulls/356/commits"},"statuses":{"href":"https://api.github.com/repos/payutc/server/statuses/69e5c3ed086d1952a78de8370618f56e521e5d75"}}}}