{"action":"created","comment":{"url":"https://api.github.com/repos/poledev/mathieu/pulls/comments/32422914","id":32422914,"diff_hunk":"@@ -1,35 +1,105 @@\n <?php\n-\n namespace SensioLabs\\JobBoardBundle\\Controller;\n \n use Sensio\\Bundle\\FrameworkExtraBundle\\Configuration\\Route;\n use Sensio\\Bundle\\FrameworkExtraBundle\\Configuration\\Template;\n use SensioLabs\\JobBoardBundle\\Entity\\Job;\n+use SensioLabs\\JobBoardBundle\\Form\\Type\\JobType;\n use Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller;\n use Symfony\\Component\\HttpFoundation\\Request;\n+use Sensio\\Bundle\\FrameworkExtraBundle\\Configuration\\Security;\n+use Sensio\\Bundle\\FrameworkExtraBundle\\Configuration\\Method;\n \n+/**\n+ * Class BackendController\n+ */\n class BackendController extends Controller\n {\n     /**\n-     * @Route(\"/backend\", name=\"backend_list\")\n+     * @Route(\n+     *      \"/backend/{status}/{page}\",\n+     *      name = \"backend_list\",\n+     *      requirements = {\"page\" = \"\\d+\"},\n+     *      defaults = {\"page\" = 1, \"status\" = \"published\"}\n+     * )\n+     * @Method({\"GET\"})\n      * @Template()\n+     * @Security(\"is_granted('IS_AUTHENTICATED_FULLY') and has_role('ROLE_SUPER_ADMIN')\")\n+     *\n+     * @param Request $request\n+     * @param string  $status\n+     * @param integer $page\n+     *\n+     * @return array\n      */\n-    public function listAction(Request $request)\n+    public function listAction(Request $request, $status, $page)\n     {\n-        return array();\n+        $jobRepository = $this->getDoctrine()->getRepository('SensioLabsJobBoardBundle:Job');\n+\n+        $query = $jobRepository->findJobs(['status' => $status]);\n+        $jobs = $this->get('knp_paginator')->paginate($query, $page, 25);\n+\n+        return [\n+            'jobs' => $jobs,\n+            'status' => $status,\n+        ];\n     }\n \n     /**\n      * @Route(\"/backend/{id}/edit\", name=\"backend_edit\")\n      * @Template()\n+     * @Method({\"GET\", \"POST\"})\n+     * @Security(\"is_granted('IS_AUTHENTICATED_FULLY') and has_role('ROLE_SUPER_ADMIN')\")\n      *\n-     * @param Request $request  The request\n-     * @param Job     $job      The job\n+     * @param Request $request The request\n+     * @param Job     $job     The job\n      *\n      * @return array\n      */\n     public function editAction(Request $request, Job $job)\n     {\n-        return array();\n+        $form = $this->createForm(new JobType(), $job, [\n+            'attr' => ['novalidate' => 'novalidate'],\n+            'is_admin' => true,\n+        ]);\n+\n+        if ($form->handleRequest($request)->isValid()) {\n+            $this->getDoctrine()->getManager()->flush($job);\n+\n+            return $this->redirect($this->generateUrl('backend_list'));\n+        }\n+\n+        return [\n+            'form' => $form->createView(),\n+            'job' => $job,\n+        ];\n+    }\n+\n+    /**\n+     * @Route(\n+     *      \"/backend/{id}/remove\",\n+     *      name = \"backend_remove\"\n+     * )\n+     * @Method({\"GET\"})\n+     * @Security(\"is_granted('IS_AUTHENTICATED_FULLY') and has_role('ROLE_SUPER_ADMIN')\")\n+     *\n+     * @param Job $job The job to remove\n+     *\n+     * @return \\Symfony\\Component\\HttpFoundation\\RedirectResponse\n+     */\n+    public function removeAction(Job $job)\n+    {\n+        $em = $this->getDoctrine()->getManager();\n+        $status = $job->getStatus();\n+\n+        if (Job::STATUS_DELETED === $job->getStatus()) {\n+            $em->remove($job);","path":"src/SensioLabs/JobBoardBundle/Controller/BackendController.php","position":103,"original_position":103,"commit_id":"af238c43a95168fc2fe9d4e4b7f3ab2ea4499295","original_commit_id":"af238c43a95168fc2fe9d4e4b7f3ab2ea4499295","user":{"login":"ogizanagi","id":2211145,"avatar_url":"https://avatars.githubusercontent.com/u/2211145?v=3","gravatar_id":"","url":"https://api.github.com/users/ogizanagi","html_url":"https://github.com/ogizanagi","followers_url":"https://api.github.com/users/ogizanagi/followers","following_url":"https://api.github.com/users/ogizanagi/following{/other_user}","gists_url":"https://api.github.com/users/ogizanagi/gists{/gist_id}","starred_url":"https://api.github.com/users/ogizanagi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ogizanagi/subscriptions","organizations_url":"https://api.github.com/users/ogizanagi/orgs","repos_url":"https://api.github.com/users/ogizanagi/repos","events_url":"https://api.github.com/users/ogizanagi/events{/privacy}","received_events_url":"https://api.github.com/users/ogizanagi/received_events","type":"User","site_admin":false},"body":"I don't think the job should be actually deleted through the admin area. The command you'll have to create will do it.","created_at":"2015-06-15T14:06:23Z","updated_at":"2015-06-15T14:06:23Z","html_url":"https://github.com/poledev/mathieu/pull/36#discussion_r32422914","pull_request_url":"https://api.github.com/repos/poledev/mathieu/pulls/36","_links":{"self":{"href":"https://api.github.com/repos/poledev/mathieu/pulls/comments/32422914"},"html":{"href":"https://github.com/poledev/mathieu/pull/36#discussion_r32422914"},"pull_request":{"href":"https://api.github.com/repos/poledev/mathieu/pulls/36"}}},"pull_request":{"url":"https://api.github.com/repos/poledev/mathieu/pulls/36","id":37476866,"html_url":"https://github.com/poledev/mathieu/pull/36","diff_url":"https://github.com/poledev/mathieu/pull/36.diff","patch_url":"https://github.com/poledev/mathieu/pull/36.patch","issue_url":"https://api.github.com/repos/poledev/mathieu/issues/36","number":36,"state":"open","locked":false,"title":"10_As an administrator, I need to see the list of published announcement","user":{"login":"mmarchois","id":2683379,"avatar_url":"https://avatars.githubusercontent.com/u/2683379?v=3","gravatar_id":"","url":"https://api.github.com/users/mmarchois","html_url":"https://github.com/mmarchois","followers_url":"https://api.github.com/users/mmarchois/followers","following_url":"https://api.github.com/users/mmarchois/following{/other_user}","gists_url":"https://api.github.com/users/mmarchois/gists{/gist_id}","starred_url":"https://api.github.com/users/mmarchois/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmarchois/subscriptions","organizations_url":"https://api.github.com/users/mmarchois/orgs","repos_url":"https://api.github.com/users/mmarchois/repos","events_url":"https://api.github.com/users/mmarchois/events{/privacy}","received_events_url":"https://api.github.com/users/mmarchois/received_events","type":"User","site_admin":false},"body":"PR 10\r\n\r\nSee https://github.com/poledev/mathieu/issues/3","created_at":"2015-06-11T15:35:12Z","updated_at":"2015-06-15T14:06:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2b25024ee28eb293cb5467bb9b39e6ce34f1165c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/poledev/mathieu/pulls/36/commits","review_comments_url":"https://api.github.com/repos/poledev/mathieu/pulls/36/comments","review_comment_url":"https://api.github.com/repos/poledev/mathieu/pulls/comments{/number}","comments_url":"https://api.github.com/repos/poledev/mathieu/issues/36/comments","statuses_url":"https://api.github.com/repos/poledev/mathieu/statuses/af238c43a95168fc2fe9d4e4b7f3ab2ea4499295","head":{"label":"poledev:issue-10","ref":"issue-10","sha":"af238c43a95168fc2fe9d4e4b7f3ab2ea4499295","user":{"login":"poledev","id":6369679,"avatar_url":"https://avatars.githubusercontent.com/u/6369679?v=3","gravatar_id":"","url":"https://api.github.com/users/poledev","html_url":"https://github.com/poledev","followers_url":"https://api.github.com/users/poledev/followers","following_url":"https://api.github.com/users/poledev/following{/other_user}","gists_url":"https://api.github.com/users/poledev/gists{/gist_id}","starred_url":"https://api.github.com/users/poledev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/poledev/subscriptions","organizations_url":"https://api.github.com/users/poledev/orgs","repos_url":"https://api.github.com/users/poledev/repos","events_url":"https://api.github.com/users/poledev/events{/privacy}","received_events_url":"https://api.github.com/users/poledev/received_events","type":"Organization","site_admin":false},"repo":{"id":36651258,"name":"mathieu","full_name":"poledev/mathieu","owner":{"login":"poledev","id":6369679,"avatar_url":"https://avatars.githubusercontent.com/u/6369679?v=3","gravatar_id":"","url":"https://api.github.com/users/poledev","html_url":"https://github.com/poledev","followers_url":"https://api.github.com/users/poledev/followers","following_url":"https://api.github.com/users/poledev/following{/other_user}","gists_url":"https://api.github.com/users/poledev/gists{/gist_id}","starred_url":"https://api.github.com/users/poledev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/poledev/subscriptions","organizations_url":"https://api.github.com/users/poledev/orgs","repos_url":"https://api.github.com/users/poledev/repos","events_url":"https://api.github.com/users/poledev/events{/privacy}","received_events_url":"https://api.github.com/users/poledev/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/poledev/mathieu","description":null,"fork":false,"url":"https://api.github.com/repos/poledev/mathieu","forks_url":"https://api.github.com/repos/poledev/mathieu/forks","keys_url":"https://api.github.com/repos/poledev/mathieu/keys{/key_id}","collaborators_url":"https://api.github.com/repos/poledev/mathieu/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/poledev/mathieu/teams","hooks_url":"https://api.github.com/repos/poledev/mathieu/hooks","issue_events_url":"https://api.github.com/repos/poledev/mathieu/issues/events{/number}","events_url":"https://api.github.com/repos/poledev/mathieu/events","assignees_url":"https://api.github.com/repos/poledev/mathieu/assignees{/user}","branches_url":"https://api.github.com/repos/poledev/mathieu/branches{/branch}","tags_url":"https://api.github.com/repos/poledev/mathieu/tags","blobs_url":"https://api.github.com/repos/poledev/mathieu/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/poledev/mathieu/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/poledev/mathieu/git/refs{/sha}","trees_url":"https://api.github.com/repos/poledev/mathieu/git/trees{/sha}","statuses_url":"https://api.github.com/repos/poledev/mathieu/statuses/{sha}","languages_url":"https://api.github.com/repos/poledev/mathieu/languages","stargazers_url":"https://api.github.com/repos/poledev/mathieu/stargazers","contributors_url":"https://api.github.com/repos/poledev/mathieu/contributors","subscribers_url":"https://api.github.com/repos/poledev/mathieu/subscribers","subscription_url":"https://api.github.com/repos/poledev/mathieu/subscription","commits_url":"https://api.github.com/repos/poledev/mathieu/commits{/sha}","git_commits_url":"https://api.github.com/repos/poledev/mathieu/git/commits{/sha}","comments_url":"https://api.github.com/repos/poledev/mathieu/comments{/number}","issue_comment_url":"https://api.github.com/repos/poledev/mathieu/issues/comments{/number}","contents_url":"https://api.github.com/repos/poledev/mathieu/contents/{+path}","compare_url":"https://api.github.com/repos/poledev/mathieu/compare/{base}...{head}","merges_url":"https://api.github.com/repos/poledev/mathieu/merges","archive_url":"https://api.github.com/repos/poledev/mathieu/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/poledev/mathieu/downloads","issues_url":"https://api.github.com/repos/poledev/mathieu/issues{/number}","pulls_url":"https://api.github.com/repos/poledev/mathieu/pulls{/number}","milestones_url":"https://api.github.com/repos/poledev/mathieu/milestones{/number}","notifications_url":"https://api.github.com/repos/poledev/mathieu/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/poledev/mathieu/labels{/name}","releases_url":"https://api.github.com/repos/poledev/mathieu/releases{/id}","created_at":"2015-06-01T09:37:39Z","updated_at":"2015-06-01T09:39:33Z","pushed_at":"2015-06-15T13:06:44Z","git_url":"git://github.com/poledev/mathieu.git","ssh_url":"git@github.com:poledev/mathieu.git","clone_url":"https://github.com/poledev/mathieu.git","svn_url":"https://github.com/poledev/mathieu","homepage":null,"size":1028,"stargazers_count":0,"watchers_count":0,"language":"CSS","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":31,"forks":0,"open_issues":31,"watchers":0,"default_branch":"master"}},"base":{"label":"poledev:master","ref":"master","sha":"e0d1e18695f14a45598eae3eeb234b777117fcfa","user":{"login":"poledev","id":6369679,"avatar_url":"https://avatars.githubusercontent.com/u/6369679?v=3","gravatar_id":"","url":"https://api.github.com/users/poledev","html_url":"https://github.com/poledev","followers_url":"https://api.github.com/users/poledev/followers","following_url":"https://api.github.com/users/poledev/following{/other_user}","gists_url":"https://api.github.com/users/poledev/gists{/gist_id}","starred_url":"https://api.github.com/users/poledev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/poledev/subscriptions","organizations_url":"https://api.github.com/users/poledev/orgs","repos_url":"https://api.github.com/users/poledev/repos","events_url":"https://api.github.com/users/poledev/events{/privacy}","received_events_url":"https://api.github.com/users/poledev/received_events","type":"Organization","site_admin":false},"repo":{"id":36651258,"name":"mathieu","full_name":"poledev/mathieu","owner":{"login":"poledev","id":6369679,"avatar_url":"https://avatars.githubusercontent.com/u/6369679?v=3","gravatar_id":"","url":"https://api.github.com/users/poledev","html_url":"https://github.com/poledev","followers_url":"https://api.github.com/users/poledev/followers","following_url":"https://api.github.com/users/poledev/following{/other_user}","gists_url":"https://api.github.com/users/poledev/gists{/gist_id}","starred_url":"https://api.github.com/users/poledev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/poledev/subscriptions","organizations_url":"https://api.github.com/users/poledev/orgs","repos_url":"https://api.github.com/users/poledev/repos","events_url":"https://api.github.com/users/poledev/events{/privacy}","received_events_url":"https://api.github.com/users/poledev/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/poledev/mathieu","description":null,"fork":false,"url":"https://api.github.com/repos/poledev/mathieu","forks_url":"https://api.github.com/repos/poledev/mathieu/forks","keys_url":"https://api.github.com/repos/poledev/mathieu/keys{/key_id}","collaborators_url":"https://api.github.com/repos/poledev/mathieu/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/poledev/mathieu/teams","hooks_url":"https://api.github.com/repos/poledev/mathieu/hooks","issue_events_url":"https://api.github.com/repos/poledev/mathieu/issues/events{/number}","events_url":"https://api.github.com/repos/poledev/mathieu/events","assignees_url":"https://api.github.com/repos/poledev/mathieu/assignees{/user}","branches_url":"https://api.github.com/repos/poledev/mathieu/branches{/branch}","tags_url":"https://api.github.com/repos/poledev/mathieu/tags","blobs_url":"https://api.github.com/repos/poledev/mathieu/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/poledev/mathieu/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/poledev/mathieu/git/refs{/sha}","trees_url":"https://api.github.com/repos/poledev/mathieu/git/trees{/sha}","statuses_url":"https://api.github.com/repos/poledev/mathieu/statuses/{sha}","languages_url":"https://api.github.com/repos/poledev/mathieu/languages","stargazers_url":"https://api.github.com/repos/poledev/mathieu/stargazers","contributors_url":"https://api.github.com/repos/poledev/mathieu/contributors","subscribers_url":"https://api.github.com/repos/poledev/mathieu/subscribers","subscription_url":"https://api.github.com/repos/poledev/mathieu/subscription","commits_url":"https://api.github.com/repos/poledev/mathieu/commits{/sha}","git_commits_url":"https://api.github.com/repos/poledev/mathieu/git/commits{/sha}","comments_url":"https://api.github.com/repos/poledev/mathieu/comments{/number}","issue_comment_url":"https://api.github.com/repos/poledev/mathieu/issues/comments{/number}","contents_url":"https://api.github.com/repos/poledev/mathieu/contents/{+path}","compare_url":"https://api.github.com/repos/poledev/mathieu/compare/{base}...{head}","merges_url":"https://api.github.com/repos/poledev/mathieu/merges","archive_url":"https://api.github.com/repos/poledev/mathieu/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/poledev/mathieu/downloads","issues_url":"https://api.github.com/repos/poledev/mathieu/issues{/number}","pulls_url":"https://api.github.com/repos/poledev/mathieu/pulls{/number}","milestones_url":"https://api.github.com/repos/poledev/mathieu/milestones{/number}","notifications_url":"https://api.github.com/repos/poledev/mathieu/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/poledev/mathieu/labels{/name}","releases_url":"https://api.github.com/repos/poledev/mathieu/releases{/id}","created_at":"2015-06-01T09:37:39Z","updated_at":"2015-06-01T09:39:33Z","pushed_at":"2015-06-15T13:06:44Z","git_url":"git://github.com/poledev/mathieu.git","ssh_url":"git@github.com:poledev/mathieu.git","clone_url":"https://github.com/poledev/mathieu.git","svn_url":"https://github.com/poledev/mathieu","homepage":null,"size":1028,"stargazers_count":0,"watchers_count":0,"language":"CSS","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":31,"forks":0,"open_issues":31,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/poledev/mathieu/pulls/36"},"html":{"href":"https://github.com/poledev/mathieu/pull/36"},"issue":{"href":"https://api.github.com/repos/poledev/mathieu/issues/36"},"comments":{"href":"https://api.github.com/repos/poledev/mathieu/issues/36/comments"},"review_comments":{"href":"https://api.github.com/repos/poledev/mathieu/pulls/36/comments"},"review_comment":{"href":"https://api.github.com/repos/poledev/mathieu/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/poledev/mathieu/pulls/36/commits"},"statuses":{"href":"https://api.github.com/repos/poledev/mathieu/statuses/af238c43a95168fc2fe9d4e4b7f3ab2ea4499295"}}}}