{"action":"created","comment":{"url":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/comments/93923534","pull_request_review_id":14454079,"id":93923534,"diff_hunk":"@@ -0,0 +1,73 @@\n+<?php\n+\n+namespace Pim\\Bundle\\CatalogBundle\\Doctrine\\Common\\Filter;\n+\n+use Doctrine\\Common\\Persistence\\ManagerRegistry;\n+use Pim\\Component\\Catalog\\Exception\\ObjectNotFoundException;\n+use Pim\\Component\\Catalog\\Model\\AttributeInterface;\n+\n+/**\n+ * Object code resolver\n+ *\n+ * @author    Julien Janvier <j.janvier@gmail.com>\n+ * @copyright 2016 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 ObjectCodeResolver\n+{\n+    /** @var ManagerRegistry */\n+    protected $managerRegistry;\n+\n+    /** @var array */\n+    protected $fieldMapping = [];\n+\n+    /**\n+     * @param ManagerRegistry $managerRegistry\n+     */\n+    public function __construct(ManagerRegistry $managerRegistry)\n+    {\n+        $this->managerRegistry = $managerRegistry;\n+    }\n+\n+    /**\n+     * {@inheritdoc}\n+     */\n+    public function getCodesFromIds($entityName, array $ids, AttributeInterface $attribute = null)\n+    {\n+        if (!isset($this->fieldMapping[$entityName])) {\n+            throw new \\InvalidArgumentException(sprintf('The class %s cannot be found', $entityName));\n+        }\n+\n+        $repository = $this->managerRegistry\n+            ->getManagerForClass($this->fieldMapping[$entityName])\n+            ->getRepository($this->fieldMapping[$entityName]);\n+\n+        $codes = [];\n+        foreach ($ids as $id) {\n+            $entity = $repository->findOneBy(['id' => $id]);\n+\n+            if (!$entity) {\n+                throw new ObjectNotFoundException(\n+                    sprintf('Object \"%s\" with id \"%s\" does not exist', $entityName, $id)\n+                );\n+            }\n+\n+            $code = $entity->getCode();\n+            if (null !== $attribute) {\n+                $code = $attribute->getCode() . '.' . $code;\n+            }\n+\n+            $codes[] = $code;\n+        }\n+\n+        return $codes;\n+    }\n+\n+    /**\n+     * {@inheritdoc}","path":"src/Pim/Bundle/CatalogBundle/Doctrine/Common/Filter/ObjectCodeResolver.php","position":67,"original_position":67,"commit_id":"587b534aea54a45361a099e1c4c253892f4d7d5d","original_commit_id":"734f143a6a25af65ac99c5c50369dd836570f1bd","user":{"login":"skeleton","id":1131230,"avatar_url":"https://avatars.githubusercontent.com/u/1131230?v=3","gravatar_id":"","url":"https://api.github.com/users/skeleton","html_url":"https://github.com/skeleton","followers_url":"https://api.github.com/users/skeleton/followers","following_url":"https://api.github.com/users/skeleton/following{/other_user}","gists_url":"https://api.github.com/users/skeleton/gists{/gist_id}","starred_url":"https://api.github.com/users/skeleton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skeleton/subscriptions","organizations_url":"https://api.github.com/users/skeleton/orgs","repos_url":"https://api.github.com/users/skeleton/repos","events_url":"https://api.github.com/users/skeleton/events{/privacy}","received_events_url":"https://api.github.com/users/skeleton/received_events","type":"User","site_admin":false},"body":"same","created_at":"2016-12-27T11:45:21Z","updated_at":"2016-12-27T11:52:35Z","html_url":"https://github.com/akeneo/pim-community-dev/pull/5387#discussion_r93923534","pull_request_url":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/5387","_links":{"self":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/comments/93923534"},"html":{"href":"https://github.com/akeneo/pim-community-dev/pull/5387#discussion_r93923534"},"pull_request":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/5387"}}},"pull_request":{"url":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/5387","id":98784708,"html_url":"https://github.com/akeneo/pim-community-dev/pull/5387","diff_url":"https://github.com/akeneo/pim-community-dev/pull/5387.diff","patch_url":"https://github.com/akeneo/pim-community-dev/pull/5387.patch","issue_url":"https://api.github.com/repos/akeneo/pim-community-dev/issues/5387","number":5387,"state":"open","locked":false,"title":"TIP-663: use codes as default in the PQB","user":{"login":"jjanvier","id":3691804,"avatar_url":"https://avatars.githubusercontent.com/u/3691804?v=3","gravatar_id":"","url":"https://api.github.com/users/jjanvier","html_url":"https://github.com/jjanvier","followers_url":"https://api.github.com/users/jjanvier/followers","following_url":"https://api.github.com/users/jjanvier/following{/other_user}","gists_url":"https://api.github.com/users/jjanvier/gists{/gist_id}","starred_url":"https://api.github.com/users/jjanvier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jjanvier/subscriptions","organizations_url":"https://api.github.com/users/jjanvier/orgs","repos_url":"https://api.github.com/users/jjanvier/repos","events_url":"https://api.github.com/users/jjanvier/events{/privacy}","received_events_url":"https://api.github.com/users/jjanvier/received_events","type":"User","site_admin":false},"body":"The end goal of this PR is to use the filters `categories`, `families` and `groups` instead of `categories.id`, `categories.code`, family.id`, `family.code`, groups.id` and `groups.code`.\r\n\r\nIs has been done following this process:\r\n* the PQB now filters by codes by default for `categories`, `groups` and `family`. Internally, it may use the IDs. I didn't touch the internal behavior, that was not the goal of this PR.\r\n* as a consequence, `categories.id`, `groups.id` and  `family.id` have been deprecated\r\n* the filters `categories`, `groups` and  `family` have been introduced and used everywhere possible\r\n* as a consequence, `categories.code`, `groups.code` and  `family.code` have also been deprecated. They are no longer used in the application.\r\n\r\n\r\n| Q                                 | A\r\n| --------------------------------- | ---\r\n| CI | running \r\n| Added Specs                       | Y\r\n| Added Behats                      |  -\r\n| Changelog updated                 | Y\r\n| Review and 2 GTM                  | :clock1:\r\n| Micro Demo to the PO (Story only) | -\r\n| Migration script                  | -\r\n| Tech Doc                          | https://github.com/akeneo/pim-docs/pull/443\r\n\r\n","created_at":"2016-12-20T16:48:22Z","updated_at":"2016-12-27T11:52:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d5e892e88e4925d879944cb0d3920b462a264fd9","assignee":{"login":"jjanvier","id":3691804,"avatar_url":"https://avatars.githubusercontent.com/u/3691804?v=3","gravatar_id":"","url":"https://api.github.com/users/jjanvier","html_url":"https://github.com/jjanvier","followers_url":"https://api.github.com/users/jjanvier/followers","following_url":"https://api.github.com/users/jjanvier/following{/other_user}","gists_url":"https://api.github.com/users/jjanvier/gists{/gist_id}","starred_url":"https://api.github.com/users/jjanvier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jjanvier/subscriptions","organizations_url":"https://api.github.com/users/jjanvier/orgs","repos_url":"https://api.github.com/users/jjanvier/repos","events_url":"https://api.github.com/users/jjanvier/events{/privacy}","received_events_url":"https://api.github.com/users/jjanvier/received_events","type":"User","site_admin":false},"assignees":[{"login":"jjanvier","id":3691804,"avatar_url":"https://avatars.githubusercontent.com/u/3691804?v=3","gravatar_id":"","url":"https://api.github.com/users/jjanvier","html_url":"https://github.com/jjanvier","followers_url":"https://api.github.com/users/jjanvier/followers","following_url":"https://api.github.com/users/jjanvier/following{/other_user}","gists_url":"https://api.github.com/users/jjanvier/gists{/gist_id}","starred_url":"https://api.github.com/users/jjanvier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jjanvier/subscriptions","organizations_url":"https://api.github.com/users/jjanvier/orgs","repos_url":"https://api.github.com/users/jjanvier/repos","events_url":"https://api.github.com/users/jjanvier/events{/privacy}","received_events_url":"https://api.github.com/users/jjanvier/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/akeneo/pim-community-dev/milestones/12","html_url":"https://github.com/akeneo/pim-community-dev/milestone/12","labels_url":"https://api.github.com/repos/akeneo/pim-community-dev/milestones/12/labels","id":1977836,"number":12,"title":"1.7.x","description":"","creator":{"login":"nidup","id":2104359,"avatar_url":"https://avatars.githubusercontent.com/u/2104359?v=3","gravatar_id":"","url":"https://api.github.com/users/nidup","html_url":"https://github.com/nidup","followers_url":"https://api.github.com/users/nidup/followers","following_url":"https://api.github.com/users/nidup/following{/other_user}","gists_url":"https://api.github.com/users/nidup/gists{/gist_id}","starred_url":"https://api.github.com/users/nidup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nidup/subscriptions","organizations_url":"https://api.github.com/users/nidup/orgs","repos_url":"https://api.github.com/users/nidup/repos","events_url":"https://api.github.com/users/nidup/events{/privacy}","received_events_url":"https://api.github.com/users/nidup/received_events","type":"User","site_admin":false},"open_issues":23,"closed_issues":22,"state":"open","created_at":"2016-09-01T13:48:06Z","updated_at":"2016-12-22T17:12:23Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/5387/commits","review_comments_url":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/5387/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/5387/comments","statuses_url":"https://api.github.com/repos/akeneo/pim-community-dev/statuses/587b534aea54a45361a099e1c4c253892f4d7d5d","head":{"label":"akeneo:TIP-663","ref":"TIP-663","sha":"587b534aea54a45361a099e1c4c253892f4d7d5d","user":{"login":"akeneo","id":2510186,"avatar_url":"https://avatars.githubusercontent.com/u/2510186?v=3","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,"name":"pim-community-dev","full_name":"akeneo/pim-community-dev","owner":{"login":"akeneo","id":2510186,"avatar_url":"https://avatars.githubusercontent.com/u/2510186?v=3","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":"2016-12-14T20:51:06Z","pushed_at":"2016-12-27T11:51:45Z","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":99132,"stargazers_count":353,"watchers_count":353,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":191,"mirror_url":null,"open_issues_count":153,"forks":191,"open_issues":153,"watchers":353,"default_branch":"master"}},"base":{"label":"akeneo:master","ref":"master","sha":"ca02e75fc75961ceb7a6f7491da19b8dbff29da9","user":{"login":"akeneo","id":2510186,"avatar_url":"https://avatars.githubusercontent.com/u/2510186?v=3","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,"name":"pim-community-dev","full_name":"akeneo/pim-community-dev","owner":{"login":"akeneo","id":2510186,"avatar_url":"https://avatars.githubusercontent.com/u/2510186?v=3","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":"2016-12-14T20:51:06Z","pushed_at":"2016-12-27T11:51:45Z","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":99132,"stargazers_count":353,"watchers_count":353,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":191,"mirror_url":null,"open_issues_count":153,"forks":191,"open_issues":153,"watchers":353,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/5387"},"html":{"href":"https://github.com/akeneo/pim-community-dev/pull/5387"},"issue":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/issues/5387"},"comments":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/issues/5387/comments"},"review_comments":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/5387/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/5387/commits"},"statuses":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/statuses/587b534aea54a45361a099e1c4c253892f4d7d5d"}}}}
{"actor":{"display_login":"skeleton"}}