{"action":"created","comment":{"url":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/comments/198179027","pull_request_review_id":132061946,"id":198179027,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5ODE3OTAyNw==","diff_hunk":"@@ -0,0 +1,88 @@\n+<?php\n+\n+declare(strict_types=1);\n+\n+namespace Pim\\Component\\Enrich\\CategoryTree;\n+\n+use Akeneo\\Tool\\Component\\Classification\\Repository\\CategoryRepositoryInterface;\n+use Akeneo\\UserManagement\\Bundle\\Context\\UserContext;\n+use Pim\\Component\\Enrich\\CategoryTree\\Query;\n+use Pim\\Component\\Enrich\\CategoryTree\\ReadModel;\n+\n+/**\n+ * @copyright 2018 Akeneo SAS (http://www.akeneo.com)\n+ * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)\n+ */\n+class ListChildrenCategoriesWithCountHandler\n+{\n+    /** @var CategoryRepositoryInterface */\n+    private $categoryRepository;\n+\n+    /** @var UserContext */\n+    private $userContext;\n+\n+    /** @var Query\\ListChildrenCategoriesWithCount */\n+    private $listAndCountIncludingSubCategories;\n+\n+    /** @var Query\\ListChildrenCategoriesWithCount */\n+    private $listAndCountWithoutIncludingSubCategories;\n+\n+    /**\n+     * @param CategoryRepositoryInterface           $categoryRepository\n+     * @param UserContext                           $userContext\n+     * @param Query\\ListChildrenCategoriesWithCount $listAndCountIncludingSubCategories\n+     * @param Query\\ListChildrenCategoriesWithCount $listAndCountWithoutIncludingSubCategories\n+     */\n+    public function __construct(\n+        CategoryRepositoryInterface $categoryRepository,\n+        UserContext $userContext,\n+        Query\\ListChildrenCategoriesWithCount $listAndCountIncludingSubCategories,\n+        Query\\ListChildrenCategoriesWithCount $listAndCountWithoutIncludingSubCategories\n+    ) {\n+        $this->categoryRepository = $categoryRepository;\n+        $this->userContext = $userContext;\n+        $this->listAndCountIncludingSubCategories = $listAndCountIncludingSubCategories;\n+        $this->listAndCountWithoutIncludingSubCategories = $listAndCountWithoutIncludingSubCategories;\n+    }\n+\n+    /**\n+     * @param ListChildrenCategoriesWithCount $parameters\n+     *\n+     * @return ReadModel\\ChildCategory[]\n+     */\n+    public function list(ListChildrenCategoriesWithCount $parameters): array","path":"src/Pim/Component/Enrich/CategoryTree/ListChildrenCategoriesWithCountHandler.php","position":53,"original_position":53,"commit_id":"c4cfa030fe3840ceab98006d397059e12f7f5322","original_commit_id":"c4cfa030fe3840ceab98006d397059e12f7f5322","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":"done","created_at":"2018-06-26T14:57:35Z","updated_at":"2018-06-26T14:57:35Z","html_url":"https://github.com/akeneo/pim-community-dev/pull/8312#discussion_r198179027","pull_request_url":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/8312","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/comments/198179027"},"html":{"href":"https://github.com/akeneo/pim-community-dev/pull/8312#discussion_r198179027"},"pull_request":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/8312"}},"in_reply_to_id":197789595},"pull_request":{"url":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/8312","id":194421872,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk0NDIxODcy","html_url":"https://github.com/akeneo/pim-community-dev/pull/8312","diff_url":"https://github.com/akeneo/pim-community-dev/pull/8312.diff","patch_url":"https://github.com/akeneo/pim-community-dev/pull/8312.patch","issue_url":"https://api.github.com/repos/akeneo/pim-community-dev/issues/8312","number":8312,"state":"open","locked":false,"title":"PIM-7371: improve the scalability of the category tree in the product grid","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\nDon't be afraid by these 3000 lines of PR, it's a lot of similarities of different queries (4 queries + spec + integration test = 1500 lines of code).\r\n\r\nI don't want to rewrite all what I did in this document for the problem and the solution I implement:\r\n\r\nhttps://github.com/ahocquard/akeneo-projects/tree/master/poc/category-tree-count\r\n\r\nSo please read it 😃 \r\n\r\nThis is the implementation of the first solution: https://github.com/ahocquard/akeneo-projects/tree/master/poc/category-tree-count\r\n\r\nFYI, this document will very probably be merged into the PIM, after some fixes (instead of keeping it into a personal repository).\r\n\r\n\r\nDo note that:\r\n\r\n- I handle only the category tree for the product grid (no asset, no published product, no category \"management\", no PEF)\r\n- I did it into a completely new directory. The code is far too much generic, let's have a thing a bit cleaner (but complex).\r\n- I didn't want to change anything about the front. The code is very hard to understand in the back-end part (genericity). It's the same for the front. It's impossible to code it again for all the use-cases.\r\n\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           | Ok\r\n| Changelog updated                 | Todo\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-06-12T22:10:12Z","updated_at":"2018-06-26T14:57:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1a5de227994e0f85a3b6e2709b5676d2b69de0e9","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/8312/commits","review_comments_url":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/8312/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/8312/comments","statuses_url":"https://api.github.com/repos/akeneo/pim-community-dev/statuses/c4cfa030fe3840ceab98006d397059e12f7f5322","head":{"label":"akeneo:PIM-7371","ref":"PIM-7371","sha":"c4cfa030fe3840ceab98006d397059e12f7f5322","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","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},"private":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-06-26T09:47:08Z","pushed_at":"2018-06-26T14:46:29Z","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":141756,"stargazers_count":522,"watchers_count":522,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":321,"mirror_url":null,"archived":false,"open_issues_count":253,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":321,"open_issues":253,"watchers":522,"default_branch":"2.3"}},"base":{"label":"akeneo:master","ref":"master","sha":"cfd670da4c2462c72d2ed1e7a1cd828c89222f77","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","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},"private":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-06-26T09:47:08Z","pushed_at":"2018-06-26T14:46:29Z","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":141756,"stargazers_count":522,"watchers_count":522,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":321,"mirror_url":null,"archived":false,"open_issues_count":253,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":321,"open_issues":253,"watchers":522,"default_branch":"2.3"}},"_links":{"self":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/8312"},"html":{"href":"https://github.com/akeneo/pim-community-dev/pull/8312"},"issue":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/issues/8312"},"comments":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/issues/8312/comments"},"review_comments":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/8312/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/8312/commits"},"statuses":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/statuses/c4cfa030fe3840ceab98006d397059e12f7f5322"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"ahocquard"}}