{"action":"created","comment":{"url":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/comments/67829725","id":67829725,"diff_hunk":"@@ -22,7 +24,7 @@\n  */\n class ProductSaver implements SaverInterface, BulkSaverInterface\n {\n-    /** @var ObjectManager */\n+    /** @var EntityManager */","path":"src/Pim/Bundle/CatalogBundle/Doctrine/Common/Saver/ProductSaver.php","position":14,"original_position":14,"commit_id":"264a4ce8be815d94d72f8bf5a43c94f7fec13f54","original_commit_id":"264a4ce8be815d94d72f8bf5a43c94f7fec13f54","user":{"login":"damien-carcel","id":5039018,"avatar_url":"https://avatars.githubusercontent.com/u/5039018?v=3","gravatar_id":"","url":"https://api.github.com/users/damien-carcel","html_url":"https://github.com/damien-carcel","followers_url":"https://api.github.com/users/damien-carcel/followers","following_url":"https://api.github.com/users/damien-carcel/following{/other_user}","gists_url":"https://api.github.com/users/damien-carcel/gists{/gist_id}","starred_url":"https://api.github.com/users/damien-carcel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/damien-carcel/subscriptions","organizations_url":"https://api.github.com/users/damien-carcel/orgs","repos_url":"https://api.github.com/users/damien-carcel/repos","events_url":"https://api.github.com/users/damien-carcel/events{/privacy}","received_events_url":"https://api.github.com/users/damien-carcel/received_events","type":"User","site_admin":false},"body":"Oups, my bad, I forgot to change that…","created_at":"2016-06-21T08:47:23Z","updated_at":"2016-06-21T08:47:23Z","html_url":"https://github.com/akeneo/pim-community-dev/pull/4596#discussion_r67829725","pull_request_url":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/4596","_links":{"self":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/comments/67829725"},"html":{"href":"https://github.com/akeneo/pim-community-dev/pull/4596#discussion_r67829725"},"pull_request":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/4596"}}},"pull_request":{"url":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/4596","id":73389453,"html_url":"https://github.com/akeneo/pim-community-dev/pull/4596","diff_url":"https://github.com/akeneo/pim-community-dev/pull/4596.diff","patch_url":"https://github.com/akeneo/pim-community-dev/pull/4596.patch","issue_url":"https://api.github.com/repos/akeneo/pim-community-dev/issues/4596","number":4596,"state":"open","locked":false,"title":"PIM-5843: Use ObjectManager::merge in ProductSaver on imports","user":{"login":"damien-carcel","id":5039018,"avatar_url":"https://avatars.githubusercontent.com/u/5039018?v=3","gravatar_id":"","url":"https://api.github.com/users/damien-carcel","html_url":"https://github.com/damien-carcel","followers_url":"https://api.github.com/users/damien-carcel/followers","following_url":"https://api.github.com/users/damien-carcel/following{/other_user}","gists_url":"https://api.github.com/users/damien-carcel/gists{/gist_id}","starred_url":"https://api.github.com/users/damien-carcel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/damien-carcel/subscriptions","organizations_url":"https://api.github.com/users/damien-carcel/orgs","repos_url":"https://api.github.com/users/damien-carcel/repos","events_url":"https://api.github.com/users/damien-carcel/events{/privacy}","received_events_url":"https://api.github.com/users/damien-carcel/received_events","type":"User","site_admin":false},"body":"**Description**\r\n\r\nIf, during an import, the same product is present on several lines, it can lead to a product duplication. For instance, if one import this:\r\n\r\n| sku        | tshirt_style\r\n-------------|-------------\r\n| OROTS_BOXL | turtleneck\r\n| OROTS_BOXL | foobar\r\n| OROTS_BOXL | sportwear\r\n\r\nif you know your IceCat demo dev catalog, you will see the second line is wrong, as the foobar option does not exist for the tshirt_style attribute.\r\n\r\nThe expected behavior would be to have the first value accepted, the second skiped, the third accepted, and eventually only this last one saved as it would overwrite the precedent.\r\n\r\nBUT, as the second value is wrong, product is skipped and detached from Doctrine unit of work. The problem is the first product, valid, was the same and is already passed to the ItemStep to be saved, so it is detached too!\r\n\r\nThe result is Doctrine will save the first product as a new one, and the third one as the existing product. And as Symfony validation already happened, it creates a duplication of SKU.\r\n\r\nThis PR solves this problem by using ObjectDetacher::merge in the ProductSaver::saveAll, to reattach the products to the UoW if needed.\r\n\r\n**Definition Of Done**\r\n\r\n| Q                                 | A\r\n| --------------------------------- | ---\r\n| Added Specs                       | Yes\r\n| Added Behats                      | Yes\r\n| Changelog updated                 | Yes\r\n| Review and 2 GTM                  | Pending\r\n| Micro Demo to the PO (Story only) | N/A\r\n| Migration script                  | No\r\n| Tech Doc                          | No\r\n","created_at":"2016-06-10T15:13:45Z","updated_at":"2016-06-21T08:47:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"988fb4d2da0b9bc6e3c4c0d9fdd2c25f54ae76df","assignee":null,"milestone":{"url":"https://api.github.com/repos/akeneo/pim-community-dev/milestones/10","html_url":"https://github.com/akeneo/pim-community-dev/milestones/1.5.x","labels_url":"https://api.github.com/repos/akeneo/pim-community-dev/milestones/10/labels","id":1371941,"number":10,"title":"1.5.x","description":"","creator":{"login":"jmleroux","id":1516770,"avatar_url":"https://avatars.githubusercontent.com/u/1516770?v=3","gravatar_id":"","url":"https://api.github.com/users/jmleroux","html_url":"https://github.com/jmleroux","followers_url":"https://api.github.com/users/jmleroux/followers","following_url":"https://api.github.com/users/jmleroux/following{/other_user}","gists_url":"https://api.github.com/users/jmleroux/gists{/gist_id}","starred_url":"https://api.github.com/users/jmleroux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmleroux/subscriptions","organizations_url":"https://api.github.com/users/jmleroux/orgs","repos_url":"https://api.github.com/users/jmleroux/repos","events_url":"https://api.github.com/users/jmleroux/events{/privacy}","received_events_url":"https://api.github.com/users/jmleroux/received_events","type":"User","site_admin":false},"open_issues":5,"closed_issues":22,"state":"open","created_at":"2015-10-23T08:17:35Z","updated_at":"2016-06-15T10:10:14Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/4596/commits","review_comments_url":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/4596/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/4596/comments","statuses_url":"https://api.github.com/repos/akeneo/pim-community-dev/statuses/264a4ce8be815d94d72f8bf5a43c94f7fec13f54","head":{"label":"akeneo:PIM-5843","ref":"PIM-5843","sha":"264a4ce8be815d94d72f8bf5a43c94f7fec13f54","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-06-17T07:14:11Z","pushed_at":"2016-06-21T08:18:56Z","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":148075,"stargazers_count":318,"watchers_count":318,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":161,"mirror_url":null,"open_issues_count":104,"forks":161,"open_issues":104,"watchers":318,"default_branch":"master"}},"base":{"label":"akeneo:1.5","ref":"1.5","sha":"2667aa468d1f7ba7862fba8687fa4fea205e66ba","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-06-17T07:14:11Z","pushed_at":"2016-06-21T08:18:56Z","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":148075,"stargazers_count":318,"watchers_count":318,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":161,"mirror_url":null,"open_issues_count":104,"forks":161,"open_issues":104,"watchers":318,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/4596"},"html":{"href":"https://github.com/akeneo/pim-community-dev/pull/4596"},"issue":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/issues/4596"},"comments":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/issues/4596/comments"},"review_comments":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/4596/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/4596/commits"},"statuses":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/statuses/264a4ce8be815d94d72f8bf5a43c94f7fec13f54"}}}}
{"actor":{"display_login":"damien-carcel"}}