GitHub PullRequestReviewCommentEvent at 2014-10-16 21:06:43
Repository: AdmingeneratorGeneratorBundle
Actor: sescandell
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/pulls/comments/18986691","id":18986691,"diff_hunk":"@@ -69,35 +69,56 @@ class ExcelController extends ListController\n     }\n \n     /**\n-     * Fills the Excel spreadsheet with data\n+     * Gets the value from the given field that will be place at an Excel cell\n+     *\n+     * @param string $field   The name of the field to extract the value\n+     * @param mixed  $rowData The main entity object\n+     *\n+     * @return $data The data to place on the respective Excel cell\n      */\n-    protected function createExcelData(\\PhpExcel_Worksheet $sheet){\n-      $row = 2;\n-      $results = $this->getResults();\n-      foreach($results as $rowData){\n-        {% set column = 0 %}\n-        {% for builder_column in builder.columns %}\n-\n-          // Retrieve relations\n-          $getter = '{{ builder_column.getter }}';\n-          $data = $rowData;\n-          while (($pos = strpos($getter, '.')) > 0){\n-            $tempGetter = 'get' . ucfirst(substr($getter, 0, $pos));\n+    protected function getValueForCell($field, $rowData)\n+    {\n+        $getter = $field;\n+        $data = $rowData;\n+        // Retrieve relations\n+        while (($pos = strpos($getter, '.')) > 0) {","path":"Resources/templates/CommonAdmin/ExcelAction/ExcelBuilderAction.php.twig","position":29,"original_position":29,"commit_id":"6c8b498a83b8014780dd03ac87f53325c669b48a","original_commit_id":"6c8b498a83b8014780dd03ac87f53325c669b48a","user":{"login":"sescandell","id":1559970,"avatar_url":"https://avatars.githubusercontent.com/u/1559970?v=2","gravatar_id":"","url":"https://api.github.com/users/sescandell","html_url":"https://github.com/sescandell","followers_url":"https://api.github.com/users/sescandell/followers","following_url":"https://api.github.com/users/sescandell/following{/other_user}","gists_url":"https://api.github.com/users/sescandell/gists{/gist_id}","starred_url":"https://api.github.com/users/sescandell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sescandell/subscriptions","organizations_url":"https://api.github.com/users/sescandell/orgs","repos_url":"https://api.github.com/users/sescandell/repos","events_url":"https://api.github.com/users/sescandell/events{/privacy}","received_events_url":"https://api.github.com/users/sescandell/received_events","type":"User","site_admin":false},"body":"Can't we you the PropertyAccessor there?","created_at":"2014-10-16T21:06:43Z","updated_at":"2014-10-16T21:06:43Z","html_url":"https://github.com/symfony2admingenerator/AdmingeneratorGeneratorBundle/pull/790#discussion_r18986691","pull_request_url":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/pulls/790","_links":{"self":{"href":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/pulls/comments/18986691"},"html":{"href":"https://github.com/symfony2admingenerator/AdmingeneratorGeneratorBundle/pull/790#discussion_r18986691"},"pull_request":{"href":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/pulls/790"}}},"pull_request":{"url":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/pulls/790","id":20955361,"html_url":"https://github.com/symfony2admingenerator/AdmingeneratorGeneratorBundle/pull/790","diff_url":"https://github.com/symfony2admingenerator/AdmingeneratorGeneratorBundle/pull/790.diff","patch_url":"https://github.com/symfony2admingenerator/AdmingeneratorGeneratorBundle/pull/790.patch","issue_url":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/issues/790","number":790,"state":"open","locked":false,"title":"(v1.0) Re-organized ExcelBuilderAction.php.twig","user":{"login":"Restless-ET","id":2746590,"avatar_url":"https://avatars.githubusercontent.com/u/2746590?v=2","gravatar_id":"","url":"https://api.github.com/users/Restless-ET","html_url":"https://github.com/Restless-ET","followers_url":"https://api.github.com/users/Restless-ET/followers","following_url":"https://api.github.com/users/Restless-ET/following{/other_user}","gists_url":"https://api.github.com/users/Restless-ET/gists{/gist_id}","starred_url":"https://api.github.com/users/Restless-ET/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Restless-ET/subscriptions","organizations_url":"https://api.github.com/users/Restless-ET/orgs","repos_url":"https://api.github.com/users/Restless-ET/repos","events_url":"https://api.github.com/users/Restless-ET/events{/privacy}","received_events_url":"https://api.github.com/users/Restless-ET/received_events","type":"User","site_admin":false},"body":"Added  a ```getValueForCell``` protected function so that extending the values format for the cells will be easier.\r\n\r\nFor instance if we need to format the value of a field which we know it's a currency, we can easily extends this method and add those special cases. E.g.:\r\n```php\r\nprotected function getValueForCell($field, $rowData)\r\n{\r\n    switch($field) {\r\n        case 'price':\r\n        case 'productionCost':\r\n            $getter = 'get'.ucfirst($field);\r\n            $data = number_format($rowData->$getter(), 2, ',', '.');\r\n            break;\r\n        default:\r\n            $data = parent::getValueForCell($field, $rowData);\r\n            break;\r\n    }\r\n    return $data;\r\n}\r\n```\r\n\r\nI don't know if this is the best example, but this can also be used to render boolean field with some text other than ```TRUE/FALSE```.","created_at":"2014-09-09T13:37:47Z","updated_at":"2014-10-16T21:06:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b11a1eb400e560f3a8e8b5920c1ed5fdad4b163b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/pulls/790/commits","review_comments_url":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/pulls/790/comments","review_comment_url":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/pulls/comments/{number}","comments_url":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/issues/790/comments","statuses_url":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/statuses/6c8b498a83b8014780dd03ac87f53325c669b48a","head":{"label":"Restless-ET:v1.0-excel-export-improvements","ref":"v1.0-excel-export-improvements","sha":"6c8b498a83b8014780dd03ac87f53325c669b48a","user":{"login":"Restless-ET","id":2746590,"avatar_url":"https://avatars.githubusercontent.com/u/2746590?v=2","gravatar_id":"","url":"https://api.github.com/users/Restless-ET","html_url":"https://github.com/Restless-ET","followers_url":"https://api.github.com/users/Restless-ET/followers","following_url":"https://api.github.com/users/Restless-ET/following{/other_user}","gists_url":"https://api.github.com/users/Restless-ET/gists{/gist_id}","starred_url":"https://api.github.com/users/Restless-ET/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Restless-ET/subscriptions","organizations_url":"https://api.github.com/users/Restless-ET/orgs","repos_url":"https://api.github.com/users/Restless-ET/repos","events_url":"https://api.github.com/users/Restless-ET/events{/privacy}","received_events_url":"https://api.github.com/users/Restless-ET/received_events","type":"User","site_admin":false},"repo":{"id":12456953,"name":"AdmingeneratorGeneratorBundle","full_name":"Restless-ET/AdmingeneratorGeneratorBundle","owner":{"login":"Restless-ET","id":2746590,"avatar_url":"https://avatars.githubusercontent.com/u/2746590?v=2","gravatar_id":"","url":"https://api.github.com/users/Restless-ET","html_url":"https://github.com/Restless-ET","followers_url":"https://api.github.com/users/Restless-ET/followers","following_url":"https://api.github.com/users/Restless-ET/following{/other_user}","gists_url":"https://api.github.com/users/Restless-ET/gists{/gist_id}","starred_url":"https://api.github.com/users/Restless-ET/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Restless-ET/subscriptions","organizations_url":"https://api.github.com/users/Restless-ET/orgs","repos_url":"https://api.github.com/users/Restless-ET/repos","events_url":"https://api.github.com/users/Restless-ET/events{/privacy}","received_events_url":"https://api.github.com/users/Restless-ET/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Restless-ET/AdmingeneratorGeneratorBundle","description":"Admingenerator for Symfony2, parse generator.yml files to build classes","fork":true,"url":"https://api.github.com/repos/Restless-ET/AdmingeneratorGeneratorBundle","forks_url":"https://api.github.com/repos/Restless-ET/AdmingeneratorGeneratorBundle/forks","keys_url":"https://api.github.com/repos/Restless-ET/AdmingeneratorGeneratorBundle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Restless-ET/AdmingeneratorGeneratorBundle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Restless-ET/AdmingeneratorGeneratorBundle/teams","hooks_url":"https://api.github.com/repos/Restless-ET/AdmingeneratorGeneratorBundle/hooks","issue_events_url":"https://api.github.com/repos/Restless-ET/AdmingeneratorGeneratorBundle/issues/events{/number}","events_url":"https://api.github.com/repos/Restless-ET/AdmingeneratorGeneratorBundle/events","assignees_url":"https://api.github.com/repos/Restless-ET/AdmingeneratorGeneratorBundle/assignees{/user}","branches_url":"https://api.github.com/repos/Restless-ET/AdmingeneratorGeneratorBundle/branches{/branch}","tags_url":"https://api.github.com/repos/Restless-ET/AdmingeneratorGeneratorBundle/tags","blobs_url":"https://api.github.com/repos/Restless-ET/AdmingeneratorGeneratorBundle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Restless-ET/AdmingeneratorGeneratorBundle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Restless-ET/AdmingeneratorGeneratorBundle/git/refs{/sha}","trees_url":"https://api.github.com/repos/Restless-ET/AdmingeneratorGeneratorBundle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Restless-ET/AdmingeneratorGeneratorBundle/statuses/{sha}","languages_url":"https://api.github.com/repos/Restless-ET/AdmingeneratorGeneratorBundle/languages","stargazers_url":"https://api.github.com/repos/Restless-ET/AdmingeneratorGeneratorBundle/stargazers","contributors_url":"https://api.github.com/repos/Restless-ET/AdmingeneratorGeneratorBundle/contributors","subscribers_url":"https://api.github.com/repos/Restless-ET/AdmingeneratorGeneratorBundle/subscribers","subscription_url":"https://api.github.com/repos/Restless-ET/AdmingeneratorGeneratorBundle/subscription","commits_url":"https://api.github.com/repos/Restless-ET/AdmingeneratorGeneratorBundle/commits{/sha}","git_commits_url":"https://api.github.com/repos/Restless-ET/AdmingeneratorGeneratorBundle/git/commits{/sha}","comments_url":"https://api.github.com/repos/Restless-ET/AdmingeneratorGeneratorBundle/comments{/number}","issue_comment_url":"https://api.github.com/repos/Restless-ET/AdmingeneratorGeneratorBundle/issues/comments/{number}","contents_url":"https://api.github.com/repos/Restless-ET/AdmingeneratorGeneratorBundle/contents/{+path}","compare_url":"https://api.github.com/repos/Restless-ET/AdmingeneratorGeneratorBundle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Restless-ET/AdmingeneratorGeneratorBundle/merges","archive_url":"https://api.github.com/repos/Restless-ET/AdmingeneratorGeneratorBundle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Restless-ET/AdmingeneratorGeneratorBundle/downloads","issues_url":"https://api.github.com/repos/Restless-ET/AdmingeneratorGeneratorBundle/issues{/number}","pulls_url":"https://api.github.com/repos/Restless-ET/AdmingeneratorGeneratorBundle/pulls{/number}","milestones_url":"https://api.github.com/repos/Restless-ET/AdmingeneratorGeneratorBundle/milestones{/number}","notifications_url":"https://api.github.com/repos/Restless-ET/AdmingeneratorGeneratorBundle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Restless-ET/AdmingeneratorGeneratorBundle/labels{/name}","releases_url":"https://api.github.com/repos/Restless-ET/AdmingeneratorGeneratorBundle/releases{/id}","created_at":"2013-08-29T09:53:03Z","updated_at":"2014-07-16T10:32:04Z","pushed_at":"2014-09-10T13:41:41Z","git_url":"git://github.com/Restless-ET/AdmingeneratorGeneratorBundle.git","ssh_url":"git@github.com:Restless-ET/AdmingeneratorGeneratorBundle.git","clone_url":"https://github.com/Restless-ET/AdmingeneratorGeneratorBundle.git","svn_url":"https://github.com/Restless-ET/AdmingeneratorGeneratorBundle","homepage":"http://symfony2admingenerator.org/","size":7645,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"symfony2admingenerator:v1.0","ref":"v1.0","sha":"7dedddadb74891b2a5bcf35e6c399edfb3b32295","user":{"login":"symfony2admingenerator","id":2056793,"avatar_url":"https://avatars.githubusercontent.com/u/2056793?v=2","gravatar_id":"","url":"https://api.github.com/users/symfony2admingenerator","html_url":"https://github.com/symfony2admingenerator","followers_url":"https://api.github.com/users/symfony2admingenerator/followers","following_url":"https://api.github.com/users/symfony2admingenerator/following{/other_user}","gists_url":"https://api.github.com/users/symfony2admingenerator/gists{/gist_id}","starred_url":"https://api.github.com/users/symfony2admingenerator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/symfony2admingenerator/subscriptions","organizations_url":"https://api.github.com/users/symfony2admingenerator/orgs","repos_url":"https://api.github.com/users/symfony2admingenerator/repos","events_url":"https://api.github.com/users/symfony2admingenerator/events{/privacy}","received_events_url":"https://api.github.com/users/symfony2admingenerator/received_events","type":"Organization","site_admin":false},"repo":{"id":2151686,"name":"AdmingeneratorGeneratorBundle","full_name":"symfony2admingenerator/AdmingeneratorGeneratorBundle","owner":{"login":"symfony2admingenerator","id":2056793,"avatar_url":"https://avatars.githubusercontent.com/u/2056793?v=2","gravatar_id":"","url":"https://api.github.com/users/symfony2admingenerator","html_url":"https://github.com/symfony2admingenerator","followers_url":"https://api.github.com/users/symfony2admingenerator/followers","following_url":"https://api.github.com/users/symfony2admingenerator/following{/other_user}","gists_url":"https://api.github.com/users/symfony2admingenerator/gists{/gist_id}","starred_url":"https://api.github.com/users/symfony2admingenerator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/symfony2admingenerator/subscriptions","organizations_url":"https://api.github.com/users/symfony2admingenerator/orgs","repos_url":"https://api.github.com/users/symfony2admingenerator/repos","events_url":"https://api.github.com/users/symfony2admingenerator/events{/privacy}","received_events_url":"https://api.github.com/users/symfony2admingenerator/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/symfony2admingenerator/AdmingeneratorGeneratorBundle","description":"(old-legacy) Admingenerator for Symfony2, parse generator.yml files to build classes","fork":false,"url":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle","forks_url":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/forks","keys_url":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/teams","hooks_url":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/hooks","issue_events_url":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/issues/events{/number}","events_url":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/events","assignees_url":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/assignees{/user}","branches_url":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/branches{/branch}","tags_url":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/tags","blobs_url":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/git/refs{/sha}","trees_url":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/statuses/{sha}","languages_url":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/languages","stargazers_url":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/stargazers","contributors_url":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/contributors","subscribers_url":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/subscribers","subscription_url":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/subscription","commits_url":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/commits{/sha}","git_commits_url":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/git/commits{/sha}","comments_url":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/comments{/number}","issue_comment_url":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/issues/comments/{number}","contents_url":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/contents/{+path}","compare_url":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/merges","archive_url":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/downloads","issues_url":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/issues{/number}","pulls_url":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/pulls{/number}","milestones_url":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/milestones{/number}","notifications_url":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/labels{/name}","releases_url":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/releases{/id}","created_at":"2011-08-03T23:29:30Z","updated_at":"2014-10-02T11:20:30Z","pushed_at":"2014-10-13T21:38:01Z","git_url":"git://github.com/symfony2admingenerator/AdmingeneratorGeneratorBundle.git","ssh_url":"git@github.com:symfony2admingenerator/AdmingeneratorGeneratorBundle.git","clone_url":"https://github.com/symfony2admingenerator/AdmingeneratorGeneratorBundle.git","svn_url":"https://github.com/symfony2admingenerator/AdmingeneratorGeneratorBundle","homepage":"http://symfony2admingenerator.org/","size":11805,"stargazers_count":375,"watchers_count":375,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":149,"mirror_url":null,"open_issues_count":44,"forks":149,"open_issues":44,"watchers":375,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/pulls/790"},"html":{"href":"https://github.com/symfony2admingenerator/AdmingeneratorGeneratorBundle/pull/790"},"issue":{"href":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/issues/790"},"comments":{"href":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/issues/790/comments"},"review_comments":{"href":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/pulls/790/comments"},"review_comment":{"href":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/pulls/790/commits"},"statuses":{"href":"https://api.github.com/repos/symfony2admingenerator/AdmingeneratorGeneratorBundle/statuses/6c8b498a83b8014780dd03ac87f53325c669b48a"}}}}