{"action":"created","comment":{"url":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/comments/240516603","pull_request_review_id":183561269,"id":240516603,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0MDUxNjYwMw==","diff_hunk":"@@ -0,0 +1,127 @@\n+# Product Grid Extensibility \n+\n+This documentation explains the different steps to add a new property into the product grid.\n+\n+In this example, we will explain here how to add a property to inform when a product has been subscribed to an external system called Suggest Data.\n+Product model rows displayed in the datagrid will not have such date as it is not possible to subscribe to this system (for example purpose).\n+\n+## Requirements\n+\n+The property to display in the product datagrid must be indexed into the product and product model Elasticsearch index.\n+\n+# Configuring the datagrid with the new property\n+ \n+In your bundle, add the following content in a new file `Resources/config/product.yml`:\n+\n+```\n+datagrid:\n+    product-grid:\n+        columns:\n+            is_subscribed_to_suggest_data:\n+                label:         Suggest Data Subscription Date\n+                data_name:     is_subscribed_to_suggest_data\n+                type:          field\n+```\n+\n+# Add the property into the read model \n+\n+The product grid returns data both from products and product models.\n+Depending of the entity, the queries are probably not the same. Therefore, you have to implement two different queries:\n+- one for the product rows\n+- one for the product model rows\n+\n+The name of the property must be the same as the name in the `data_name` configuration key in the file `Resources/config/product.yml`.\n+\n+You have to add the new property in both the product and product models rows.\n+If one of these entities does not have such property, a `null` value should be added for the property, as it is declared in the datagrid configuration.\n+\n+## Add the property into the product rows\n+\n+Create a class. In this example, all products will have a subscribed date of the current time.\n+\n+Of course, you will probably execute an SQL query or call an external service to get the fetch the data. \n+Please avoid to execute one call per row and try to execute one query to get all data at once, for performance reason.\n+\n+```\n+<?php\n+\n+declare(strict_types=1);\n+\n+namespace Acme\\Bundle\\AppBundle\\Query;\n+\n+use Akeneo\\Pim\\Enrichment\\Component\\Product\\Grid\\Query\\AddAdditionalProductProperties;\n+use Akeneo\\Pim\\Enrichment\\Component\\Product\\Grid\\Query\\FetchProductAndProductModelRowsParameters;\n+use Akeneo\\Pim\\Enrichment\\Component\\Product\\Grid\\ReadModel\\AdditionalProperty;\n+\n+class FetchSubscriptionDateForProductRows implements AddAdditionalProductProperties\n+{\n+    /**\n+     * {@inheritdoc}\n+     */\n+    public function add(FetchProductAndProductModelRowsParameters $queryParameters, array $rows): array\n+    {\n+        $rowsWithAdditionalProperty = [];\n+        \n+        $currentDate = new \\DateTime();\n+        $formattedCurrentDate= $now->format('c')\n+        foreach ($rows as $row) {\n+            $property = new AdditionalProperty('is_subscribed_to_suggest_data', $formattedCurrentDate);","path":"internal_doc/extensibility/product_grid.md","position":68,"original_position":68,"commit_id":"29d475a2185efabc83b7a5575c71a7f52b20f21c","original_commit_id":"29d475a2185efabc83b7a5575c71a7f52b20f21c","user":{"login":"fitn","id":2131005,"node_id":"MDQ6VXNlcjIxMzEwMDU=","avatar_url":"https://avatars3.githubusercontent.com/u/2131005?v=4","gravatar_id":"","url":"https://api.github.com/users/fitn","html_url":"https://github.com/fitn","followers_url":"https://api.github.com/users/fitn/followers","following_url":"https://api.github.com/users/fitn/following{/other_user}","gists_url":"https://api.github.com/users/fitn/gists{/gist_id}","starred_url":"https://api.github.com/users/fitn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fitn/subscriptions","organizations_url":"https://api.github.com/users/fitn/orgs","repos_url":"https://api.github.com/users/fitn/repos","events_url":"https://api.github.com/users/fitn/events{/privacy}","received_events_url":"https://api.github.com/users/fitn/received_events","type":"User","site_admin":false},"body":"```suggestion\r\n            $property = new AdditionalProperty('is_subscribed_to_data_provider', $formattedCurrentDate);\r\n```","created_at":"2018-12-11T08:50:26Z","updated_at":"2018-12-11T08:56:13Z","html_url":"https://github.com/akeneo/pim-community-dev/pull/9212#discussion_r240516603","pull_request_url":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/9212","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/comments/240516603"},"html":{"href":"https://github.com/akeneo/pim-community-dev/pull/9212#discussion_r240516603"},"pull_request":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/9212"}}},"pull_request":{"url":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/9212","id":236219783,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM2MjE5Nzgz","html_url":"https://github.com/akeneo/pim-community-dev/pull/9212","diff_url":"https://github.com/akeneo/pim-community-dev/pull/9212.diff","patch_url":"https://github.com/akeneo/pim-community-dev/pull/9212.patch","issue_url":"https://api.github.com/repos/akeneo/pim-community-dev/issues/9212","number":9212,"state":"open","locked":false,"title":"PIM-7660: add an extension point in the datagrid","user":{"login":"ahocquard","id":1942439,"node_id":"MDQ6VXNlcjE5NDI0Mzk=","avatar_url":"https://avatars0.githubusercontent.com/u/1942439?v=4","gravatar_id":"","url":"https://api.github.com/users/ahocquard","html_url":"https://github.com/ahocquard","followers_url":"https://api.github.com/users/ahocquard/followers","following_url":"https://api.github.com/users/ahocquard/following{/other_user}","gists_url":"https://api.github.com/users/ahocquard/gists{/gist_id}","starred_url":"https://api.github.com/users/ahocquard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahocquard/subscriptions","organizations_url":"https://api.github.com/users/ahocquard/orgs","repos_url":"https://api.github.com/users/ahocquard/repos","events_url":"https://api.github.com/users/ahocquard/events{/privacy}","received_events_url":"https://api.github.com/users/ahocquard/received_events","type":"User","site_admin":false},"body":"<!--- (<3 Thanks for taking the time to contribute! You're awesome! <3) --->\r\n\r\n<!--- (If you've never contributed to this repository before, please read https://github.com/akeneo/pim-community-dev/blob/master/.github/CONTRIBUTING.md) --->\r\n\r\n**Description (for Contributor and Core Developer)**\r\nSee with @fitn :\r\n\r\nFor now, we document it internally as we don't have such cookbook.\r\n\r\n<!--- (What does this Pull Request do? reference the related issue?) --->\r\n\r\n**Definition Of Done (for Core Developer only)**\r\n\r\n| Q                                 | A\r\n| --------------------------------- | ---\r\n| Added Specs                       | Ok\r\n| Added legacy Behats               | -\r\n| Added acceptance tests            | -\r\n| Added integration tests           | -\r\n| Changelog updated                 | -\r\n| Review and 2 GTM                  | Todo\r\n| Micro Demo to the PO (Story only) | Todo\r\n| Migration script                  | -\r\n| Tech Doc                          | -\r\n\r\n`Todo`: Pending / Work in progress\r\n`OK`: Done / Validated\r\n`-`: Not needed\r\n","created_at":"2018-12-05T15:37:54Z","updated_at":"2018-12-11T08:56:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7a7ffca3047df64513c6e036c9858ee892101fcf","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/9212/commits","review_comments_url":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/9212/comments","review_comment_url":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/comments{/number}","comments_url":"https://api.github.com/repos/akeneo/pim-community-dev/issues/9212/comments","statuses_url":"https://api.github.com/repos/akeneo/pim-community-dev/statuses/29d475a2185efabc83b7a5575c71a7f52b20f21c","head":{"label":"akeneo:product-datagrid-extensibility","ref":"product-datagrid-extensibility","sha":"29d475a2185efabc83b7a5575c71a7f52b20f21c","user":{"login":"akeneo","id":2510186,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI1MTAxODY=","avatar_url":"https://avatars0.githubusercontent.com/u/2510186?v=4","gravatar_id":"","url":"https://api.github.com/users/akeneo","html_url":"https://github.com/akeneo","followers_url":"https://api.github.com/users/akeneo/followers","following_url":"https://api.github.com/users/akeneo/following{/other_user}","gists_url":"https://api.github.com/users/akeneo/gists{/gist_id}","starred_url":"https://api.github.com/users/akeneo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akeneo/subscriptions","organizations_url":"https://api.github.com/users/akeneo/orgs","repos_url":"https://api.github.com/users/akeneo/repos","events_url":"https://api.github.com/users/akeneo/events{/privacy}","received_events_url":"https://api.github.com/users/akeneo/received_events","type":"Organization","site_admin":false},"repo":{"id":5367323,"node_id":"MDEwOlJlcG9zaXRvcnk1MzY3MzIz","name":"pim-community-dev","full_name":"akeneo/pim-community-dev","private":false,"owner":{"login":"akeneo","id":2510186,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI1MTAxODY=","avatar_url":"https://avatars0.githubusercontent.com/u/2510186?v=4","gravatar_id":"","url":"https://api.github.com/users/akeneo","html_url":"https://github.com/akeneo","followers_url":"https://api.github.com/users/akeneo/followers","following_url":"https://api.github.com/users/akeneo/following{/other_user}","gists_url":"https://api.github.com/users/akeneo/gists{/gist_id}","starred_url":"https://api.github.com/users/akeneo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akeneo/subscriptions","organizations_url":"https://api.github.com/users/akeneo/orgs","repos_url":"https://api.github.com/users/akeneo/repos","events_url":"https://api.github.com/users/akeneo/events{/privacy}","received_events_url":"https://api.github.com/users/akeneo/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/akeneo/pim-community-dev","description":"[Community Development Repository] The open source Product Information Management (PIM)","fork":false,"url":"https://api.github.com/repos/akeneo/pim-community-dev","forks_url":"https://api.github.com/repos/akeneo/pim-community-dev/forks","keys_url":"https://api.github.com/repos/akeneo/pim-community-dev/keys{/key_id}","collaborators_url":"https://api.github.com/repos/akeneo/pim-community-dev/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/akeneo/pim-community-dev/teams","hooks_url":"https://api.github.com/repos/akeneo/pim-community-dev/hooks","issue_events_url":"https://api.github.com/repos/akeneo/pim-community-dev/issues/events{/number}","events_url":"https://api.github.com/repos/akeneo/pim-community-dev/events","assignees_url":"https://api.github.com/repos/akeneo/pim-community-dev/assignees{/user}","branches_url":"https://api.github.com/repos/akeneo/pim-community-dev/branches{/branch}","tags_url":"https://api.github.com/repos/akeneo/pim-community-dev/tags","blobs_url":"https://api.github.com/repos/akeneo/pim-community-dev/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/akeneo/pim-community-dev/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/akeneo/pim-community-dev/git/refs{/sha}","trees_url":"https://api.github.com/repos/akeneo/pim-community-dev/git/trees{/sha}","statuses_url":"https://api.github.com/repos/akeneo/pim-community-dev/statuses/{sha}","languages_url":"https://api.github.com/repos/akeneo/pim-community-dev/languages","stargazers_url":"https://api.github.com/repos/akeneo/pim-community-dev/stargazers","contributors_url":"https://api.github.com/repos/akeneo/pim-community-dev/contributors","subscribers_url":"https://api.github.com/repos/akeneo/pim-community-dev/subscribers","subscription_url":"https://api.github.com/repos/akeneo/pim-community-dev/subscription","commits_url":"https://api.github.com/repos/akeneo/pim-community-dev/commits{/sha}","git_commits_url":"https://api.github.com/repos/akeneo/pim-community-dev/git/commits{/sha}","comments_url":"https://api.github.com/repos/akeneo/pim-community-dev/comments{/number}","issue_comment_url":"https://api.github.com/repos/akeneo/pim-community-dev/issues/comments{/number}","contents_url":"https://api.github.com/repos/akeneo/pim-community-dev/contents/{+path}","compare_url":"https://api.github.com/repos/akeneo/pim-community-dev/compare/{base}...{head}","merges_url":"https://api.github.com/repos/akeneo/pim-community-dev/merges","archive_url":"https://api.github.com/repos/akeneo/pim-community-dev/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/akeneo/pim-community-dev/downloads","issues_url":"https://api.github.com/repos/akeneo/pim-community-dev/issues{/number}","pulls_url":"https://api.github.com/repos/akeneo/pim-community-dev/pulls{/number}","milestones_url":"https://api.github.com/repos/akeneo/pim-community-dev/milestones{/number}","notifications_url":"https://api.github.com/repos/akeneo/pim-community-dev/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/akeneo/pim-community-dev/labels{/name}","releases_url":"https://api.github.com/repos/akeneo/pim-community-dev/releases{/id}","deployments_url":"https://api.github.com/repos/akeneo/pim-community-dev/deployments","created_at":"2012-08-10T09:27:26Z","updated_at":"2018-12-10T14:48:42Z","pushed_at":"2018-12-11T07:45:08Z","git_url":"git://github.com/akeneo/pim-community-dev.git","ssh_url":"git@github.com:akeneo/pim-community-dev.git","clone_url":"https://github.com/akeneo/pim-community-dev.git","svn_url":"https://github.com/akeneo/pim-community-dev","homepage":"http://www.akeneo.com","size":151652,"stargazers_count":558,"watchers_count":558,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":334,"mirror_url":null,"archived":false,"open_issues_count":291,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":334,"open_issues":291,"watchers":558,"default_branch":"master"}},"base":{"label":"akeneo:master","ref":"master","sha":"8d33abc181a2495c00126eaffd218c91b9d41993","user":{"login":"akeneo","id":2510186,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI1MTAxODY=","avatar_url":"https://avatars0.githubusercontent.com/u/2510186?v=4","gravatar_id":"","url":"https://api.github.com/users/akeneo","html_url":"https://github.com/akeneo","followers_url":"https://api.github.com/users/akeneo/followers","following_url":"https://api.github.com/users/akeneo/following{/other_user}","gists_url":"https://api.github.com/users/akeneo/gists{/gist_id}","starred_url":"https://api.github.com/users/akeneo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akeneo/subscriptions","organizations_url":"https://api.github.com/users/akeneo/orgs","repos_url":"https://api.github.com/users/akeneo/repos","events_url":"https://api.github.com/users/akeneo/events{/privacy}","received_events_url":"https://api.github.com/users/akeneo/received_events","type":"Organization","site_admin":false},"repo":{"id":5367323,"node_id":"MDEwOlJlcG9zaXRvcnk1MzY3MzIz","name":"pim-community-dev","full_name":"akeneo/pim-community-dev","private":false,"owner":{"login":"akeneo","id":2510186,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI1MTAxODY=","avatar_url":"https://avatars0.githubusercontent.com/u/2510186?v=4","gravatar_id":"","url":"https://api.github.com/users/akeneo","html_url":"https://github.com/akeneo","followers_url":"https://api.github.com/users/akeneo/followers","following_url":"https://api.github.com/users/akeneo/following{/other_user}","gists_url":"https://api.github.com/users/akeneo/gists{/gist_id}","starred_url":"https://api.github.com/users/akeneo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akeneo/subscriptions","organizations_url":"https://api.github.com/users/akeneo/orgs","repos_url":"https://api.github.com/users/akeneo/repos","events_url":"https://api.github.com/users/akeneo/events{/privacy}","received_events_url":"https://api.github.com/users/akeneo/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/akeneo/pim-community-dev","description":"[Community Development Repository] The open source Product Information Management (PIM)","fork":false,"url":"https://api.github.com/repos/akeneo/pim-community-dev","forks_url":"https://api.github.com/repos/akeneo/pim-community-dev/forks","keys_url":"https://api.github.com/repos/akeneo/pim-community-dev/keys{/key_id}","collaborators_url":"https://api.github.com/repos/akeneo/pim-community-dev/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/akeneo/pim-community-dev/teams","hooks_url":"https://api.github.com/repos/akeneo/pim-community-dev/hooks","issue_events_url":"https://api.github.com/repos/akeneo/pim-community-dev/issues/events{/number}","events_url":"https://api.github.com/repos/akeneo/pim-community-dev/events","assignees_url":"https://api.github.com/repos/akeneo/pim-community-dev/assignees{/user}","branches_url":"https://api.github.com/repos/akeneo/pim-community-dev/branches{/branch}","tags_url":"https://api.github.com/repos/akeneo/pim-community-dev/tags","blobs_url":"https://api.github.com/repos/akeneo/pim-community-dev/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/akeneo/pim-community-dev/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/akeneo/pim-community-dev/git/refs{/sha}","trees_url":"https://api.github.com/repos/akeneo/pim-community-dev/git/trees{/sha}","statuses_url":"https://api.github.com/repos/akeneo/pim-community-dev/statuses/{sha}","languages_url":"https://api.github.com/repos/akeneo/pim-community-dev/languages","stargazers_url":"https://api.github.com/repos/akeneo/pim-community-dev/stargazers","contributors_url":"https://api.github.com/repos/akeneo/pim-community-dev/contributors","subscribers_url":"https://api.github.com/repos/akeneo/pim-community-dev/subscribers","subscription_url":"https://api.github.com/repos/akeneo/pim-community-dev/subscription","commits_url":"https://api.github.com/repos/akeneo/pim-community-dev/commits{/sha}","git_commits_url":"https://api.github.com/repos/akeneo/pim-community-dev/git/commits{/sha}","comments_url":"https://api.github.com/repos/akeneo/pim-community-dev/comments{/number}","issue_comment_url":"https://api.github.com/repos/akeneo/pim-community-dev/issues/comments{/number}","contents_url":"https://api.github.com/repos/akeneo/pim-community-dev/contents/{+path}","compare_url":"https://api.github.com/repos/akeneo/pim-community-dev/compare/{base}...{head}","merges_url":"https://api.github.com/repos/akeneo/pim-community-dev/merges","archive_url":"https://api.github.com/repos/akeneo/pim-community-dev/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/akeneo/pim-community-dev/downloads","issues_url":"https://api.github.com/repos/akeneo/pim-community-dev/issues{/number}","pulls_url":"https://api.github.com/repos/akeneo/pim-community-dev/pulls{/number}","milestones_url":"https://api.github.com/repos/akeneo/pim-community-dev/milestones{/number}","notifications_url":"https://api.github.com/repos/akeneo/pim-community-dev/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/akeneo/pim-community-dev/labels{/name}","releases_url":"https://api.github.com/repos/akeneo/pim-community-dev/releases{/id}","deployments_url":"https://api.github.com/repos/akeneo/pim-community-dev/deployments","created_at":"2012-08-10T09:27:26Z","updated_at":"2018-12-10T14:48:42Z","pushed_at":"2018-12-11T07:45:08Z","git_url":"git://github.com/akeneo/pim-community-dev.git","ssh_url":"git@github.com:akeneo/pim-community-dev.git","clone_url":"https://github.com/akeneo/pim-community-dev.git","svn_url":"https://github.com/akeneo/pim-community-dev","homepage":"http://www.akeneo.com","size":151652,"stargazers_count":558,"watchers_count":558,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":334,"mirror_url":null,"archived":false,"open_issues_count":291,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":334,"open_issues":291,"watchers":558,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/9212"},"html":{"href":"https://github.com/akeneo/pim-community-dev/pull/9212"},"issue":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/issues/9212"},"comments":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/issues/9212/comments"},"review_comments":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/9212/comments"},"review_comment":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/9212/commits"},"statuses":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/statuses/29d475a2185efabc83b7a5575c71a7f52b20f21c"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"fitn"}}