{"action":"created","comment":{"url":"https://api.github.com/repos/snowio/magento2-attribute-option-code/pulls/comments/209263828","pull_request_review_id":145246906,"id":209263828,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwOTI2MzgyOA==","diff_hunk":"@@ -1,25 +1,41 @@\n <?php\n namespace SnowIO\\AttributeOptionCode\\Model;\n \n+use Magento\\Framework\\Exception\\InputException;\n+use Magento\\Framework\\Phrase;\n+use Magento\\Store\\Model\\Store;\n use SnowIO\\AttributeOptionCode\\Api\\Data\\ProductInterface;\n use SnowIO\\AttributeOptionCode\\Api\\ProductRepositoryInterface;\n \n class ProductRepository implements ProductRepositoryInterface\n {\n     private $vanillaRepository;\n     private $productDataMapper;\n+    private $storeManager;\n \n     public function __construct(\n         \\Magento\\Catalog\\Api\\ProductRepositoryInterface $vanillaRepository,\n-        ProductDataMapper $productDataMapper\n+        ProductDataMapper $productDataMapper,\n+        \\Magento\\Store\\Model\\StoreManagerInterface $storeManager\n     ) {\n         $this->vanillaRepository = $vanillaRepository;\n         $this->productDataMapper = $productDataMapper;\n+        $this->storeManager = $storeManager;\n     }\n \n     public function save(ProductInterface $product, $saveOptions = false)\n     {\n+        if ($this->storeManager->getStore()->getCode() !== Store::ADMIN_CODE) {\n+            if (!$product->getIdBySku($product->getSku())) {","path":"Model/ProductRepository.php","position":null,"original_position":30,"commit_id":"52e199b349a9315ebc25a516336628d36dcbd3d9","original_commit_id":"408bb815cf9dc61566dfb249e880d150ad5ec83c","user":{"login":"convenient","id":600190,"node_id":"MDQ6VXNlcjYwMDE5MA==","avatar_url":"https://avatars0.githubusercontent.com/u/600190?v=4","gravatar_id":"","url":"https://api.github.com/users/convenient","html_url":"https://github.com/convenient","followers_url":"https://api.github.com/users/convenient/followers","following_url":"https://api.github.com/users/convenient/following{/other_user}","gists_url":"https://api.github.com/users/convenient/gists{/gist_id}","starred_url":"https://api.github.com/users/convenient/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/convenient/subscriptions","organizations_url":"https://api.github.com/users/convenient/orgs","repos_url":"https://api.github.com/users/convenient/repos","events_url":"https://api.github.com/users/convenient/events{/privacy}","received_events_url":"https://api.github.com/users/convenient/received_events","type":"User","site_admin":false},"body":"![correct](https://i.imgur.com/PpV0evc.png)\r\n\r\nThanks @joshdifabio, rebased.","created_at":"2018-08-10T13:45:51Z","updated_at":"2018-08-10T13:45:51Z","html_url":"https://github.com/snowio/magento2-attribute-option-code/pull/8#discussion_r209263828","pull_request_url":"https://api.github.com/repos/snowio/magento2-attribute-option-code/pulls/8","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/snowio/magento2-attribute-option-code/pulls/comments/209263828"},"html":{"href":"https://github.com/snowio/magento2-attribute-option-code/pull/8#discussion_r209263828"},"pull_request":{"href":"https://api.github.com/repos/snowio/magento2-attribute-option-code/pulls/8"}},"in_reply_to_id":208970921},"pull_request":{"url":"https://api.github.com/repos/snowio/magento2-attribute-option-code/pulls/8","id":207299086,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA3Mjk5MDg2","html_url":"https://github.com/snowio/magento2-attribute-option-code/pull/8","diff_url":"https://github.com/snowio/magento2-attribute-option-code/pull/8.diff","patch_url":"https://github.com/snowio/magento2-attribute-option-code/pull/8.patch","issue_url":"https://api.github.com/repos/snowio/magento2-attribute-option-code/issues/8","number":8,"state":"open","locked":false,"title":"Ensure products are created in Admin scope first","user":{"login":"convenient","id":600190,"node_id":"MDQ6VXNlcjYwMDE5MA==","avatar_url":"https://avatars0.githubusercontent.com/u/600190?v=4","gravatar_id":"","url":"https://api.github.com/users/convenient","html_url":"https://github.com/convenient","followers_url":"https://api.github.com/users/convenient/followers","following_url":"https://api.github.com/users/convenient/following{/other_user}","gists_url":"https://api.github.com/users/convenient/gists{/gist_id}","starred_url":"https://api.github.com/users/convenient/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/convenient/subscriptions","organizations_url":"https://api.github.com/users/convenient/orgs","repos_url":"https://api.github.com/users/convenient/repos","events_url":"https://api.github.com/users/convenient/events{/privacy}","received_events_url":"https://api.github.com/users/convenient/received_events","type":"User","site_admin":false},"body":"I have seen issues where\r\n- products are created in a store specific scope\r\n- updated in the admin scope\r\n- Some of the values in the store specific scope incorrectly have \"Use Default Value\" set against them\r\n\r\nThis exception will ensure that products are created and fully defined in the admin scope prior to any store specific updates.","created_at":"2018-08-09T12:26:46Z","updated_at":"2018-08-10T13:45:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"20750abd681b1b883fc986a91df1437bf6fc6be5","assignee":null,"assignees":[],"requested_reviewers":[{"login":"qrz-io","id":3646206,"node_id":"MDQ6VXNlcjM2NDYyMDY=","avatar_url":"https://avatars3.githubusercontent.com/u/3646206?v=4","gravatar_id":"","url":"https://api.github.com/users/qrz-io","html_url":"https://github.com/qrz-io","followers_url":"https://api.github.com/users/qrz-io/followers","following_url":"https://api.github.com/users/qrz-io/following{/other_user}","gists_url":"https://api.github.com/users/qrz-io/gists{/gist_id}","starred_url":"https://api.github.com/users/qrz-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qrz-io/subscriptions","organizations_url":"https://api.github.com/users/qrz-io/orgs","repos_url":"https://api.github.com/users/qrz-io/repos","events_url":"https://api.github.com/users/qrz-io/events{/privacy}","received_events_url":"https://api.github.com/users/qrz-io/received_events","type":"User","site_admin":false},{"login":"brettlcooper","id":3890133,"node_id":"MDQ6VXNlcjM4OTAxMzM=","avatar_url":"https://avatars3.githubusercontent.com/u/3890133?v=4","gravatar_id":"","url":"https://api.github.com/users/brettlcooper","html_url":"https://github.com/brettlcooper","followers_url":"https://api.github.com/users/brettlcooper/followers","following_url":"https://api.github.com/users/brettlcooper/following{/other_user}","gists_url":"https://api.github.com/users/brettlcooper/gists{/gist_id}","starred_url":"https://api.github.com/users/brettlcooper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brettlcooper/subscriptions","organizations_url":"https://api.github.com/users/brettlcooper/orgs","repos_url":"https://api.github.com/users/brettlcooper/repos","events_url":"https://api.github.com/users/brettlcooper/events{/privacy}","received_events_url":"https://api.github.com/users/brettlcooper/received_events","type":"User","site_admin":false},{"login":"alexanderwanyoike","id":11722950,"node_id":"MDQ6VXNlcjExNzIyOTUw","avatar_url":"https://avatars1.githubusercontent.com/u/11722950?v=4","gravatar_id":"","url":"https://api.github.com/users/alexanderwanyoike","html_url":"https://github.com/alexanderwanyoike","followers_url":"https://api.github.com/users/alexanderwanyoike/followers","following_url":"https://api.github.com/users/alexanderwanyoike/following{/other_user}","gists_url":"https://api.github.com/users/alexanderwanyoike/gists{/gist_id}","starred_url":"https://api.github.com/users/alexanderwanyoike/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexanderwanyoike/subscriptions","organizations_url":"https://api.github.com/users/alexanderwanyoike/orgs","repos_url":"https://api.github.com/users/alexanderwanyoike/repos","events_url":"https://api.github.com/users/alexanderwanyoike/events{/privacy}","received_events_url":"https://api.github.com/users/alexanderwanyoike/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/snowio/magento2-attribute-option-code/pulls/8/commits","review_comments_url":"https://api.github.com/repos/snowio/magento2-attribute-option-code/pulls/8/comments","review_comment_url":"https://api.github.com/repos/snowio/magento2-attribute-option-code/pulls/comments{/number}","comments_url":"https://api.github.com/repos/snowio/magento2-attribute-option-code/issues/8/comments","statuses_url":"https://api.github.com/repos/snowio/magento2-attribute-option-code/statuses/52e199b349a9315ebc25a516336628d36dcbd3d9","head":{"label":"convenient:master","ref":"master","sha":"52e199b349a9315ebc25a516336628d36dcbd3d9","user":{"login":"convenient","id":600190,"node_id":"MDQ6VXNlcjYwMDE5MA==","avatar_url":"https://avatars0.githubusercontent.com/u/600190?v=4","gravatar_id":"","url":"https://api.github.com/users/convenient","html_url":"https://github.com/convenient","followers_url":"https://api.github.com/users/convenient/followers","following_url":"https://api.github.com/users/convenient/following{/other_user}","gists_url":"https://api.github.com/users/convenient/gists{/gist_id}","starred_url":"https://api.github.com/users/convenient/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/convenient/subscriptions","organizations_url":"https://api.github.com/users/convenient/orgs","repos_url":"https://api.github.com/users/convenient/repos","events_url":"https://api.github.com/users/convenient/events{/privacy}","received_events_url":"https://api.github.com/users/convenient/received_events","type":"User","site_admin":false},"repo":{"id":144148314,"node_id":"MDEwOlJlcG9zaXRvcnkxNDQxNDgzMTQ=","name":"magento2-attribute-option-code","full_name":"convenient/magento2-attribute-option-code","owner":{"login":"convenient","id":600190,"node_id":"MDQ6VXNlcjYwMDE5MA==","avatar_url":"https://avatars0.githubusercontent.com/u/600190?v=4","gravatar_id":"","url":"https://api.github.com/users/convenient","html_url":"https://github.com/convenient","followers_url":"https://api.github.com/users/convenient/followers","following_url":"https://api.github.com/users/convenient/following{/other_user}","gists_url":"https://api.github.com/users/convenient/gists{/gist_id}","starred_url":"https://api.github.com/users/convenient/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/convenient/subscriptions","organizations_url":"https://api.github.com/users/convenient/orgs","repos_url":"https://api.github.com/users/convenient/repos","events_url":"https://api.github.com/users/convenient/events{/privacy}","received_events_url":"https://api.github.com/users/convenient/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/convenient/magento2-attribute-option-code","description":null,"fork":true,"url":"https://api.github.com/repos/convenient/magento2-attribute-option-code","forks_url":"https://api.github.com/repos/convenient/magento2-attribute-option-code/forks","keys_url":"https://api.github.com/repos/convenient/magento2-attribute-option-code/keys{/key_id}","collaborators_url":"https://api.github.com/repos/convenient/magento2-attribute-option-code/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/convenient/magento2-attribute-option-code/teams","hooks_url":"https://api.github.com/repos/convenient/magento2-attribute-option-code/hooks","issue_events_url":"https://api.github.com/repos/convenient/magento2-attribute-option-code/issues/events{/number}","events_url":"https://api.github.com/repos/convenient/magento2-attribute-option-code/events","assignees_url":"https://api.github.com/repos/convenient/magento2-attribute-option-code/assignees{/user}","branches_url":"https://api.github.com/repos/convenient/magento2-attribute-option-code/branches{/branch}","tags_url":"https://api.github.com/repos/convenient/magento2-attribute-option-code/tags","blobs_url":"https://api.github.com/repos/convenient/magento2-attribute-option-code/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/convenient/magento2-attribute-option-code/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/convenient/magento2-attribute-option-code/git/refs{/sha}","trees_url":"https://api.github.com/repos/convenient/magento2-attribute-option-code/git/trees{/sha}","statuses_url":"https://api.github.com/repos/convenient/magento2-attribute-option-code/statuses/{sha}","languages_url":"https://api.github.com/repos/convenient/magento2-attribute-option-code/languages","stargazers_url":"https://api.github.com/repos/convenient/magento2-attribute-option-code/stargazers","contributors_url":"https://api.github.com/repos/convenient/magento2-attribute-option-code/contributors","subscribers_url":"https://api.github.com/repos/convenient/magento2-attribute-option-code/subscribers","subscription_url":"https://api.github.com/repos/convenient/magento2-attribute-option-code/subscription","commits_url":"https://api.github.com/repos/convenient/magento2-attribute-option-code/commits{/sha}","git_commits_url":"https://api.github.com/repos/convenient/magento2-attribute-option-code/git/commits{/sha}","comments_url":"https://api.github.com/repos/convenient/magento2-attribute-option-code/comments{/number}","issue_comment_url":"https://api.github.com/repos/convenient/magento2-attribute-option-code/issues/comments{/number}","contents_url":"https://api.github.com/repos/convenient/magento2-attribute-option-code/contents/{+path}","compare_url":"https://api.github.com/repos/convenient/magento2-attribute-option-code/compare/{base}...{head}","merges_url":"https://api.github.com/repos/convenient/magento2-attribute-option-code/merges","archive_url":"https://api.github.com/repos/convenient/magento2-attribute-option-code/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/convenient/magento2-attribute-option-code/downloads","issues_url":"https://api.github.com/repos/convenient/magento2-attribute-option-code/issues{/number}","pulls_url":"https://api.github.com/repos/convenient/magento2-attribute-option-code/pulls{/number}","milestones_url":"https://api.github.com/repos/convenient/magento2-attribute-option-code/milestones{/number}","notifications_url":"https://api.github.com/repos/convenient/magento2-attribute-option-code/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/convenient/magento2-attribute-option-code/labels{/name}","releases_url":"https://api.github.com/repos/convenient/magento2-attribute-option-code/releases{/id}","deployments_url":"https://api.github.com/repos/convenient/magento2-attribute-option-code/deployments","created_at":"2018-08-09T12:15:55Z","updated_at":"2018-08-10T13:44:26Z","pushed_at":"2018-08-10T13:44:24Z","git_url":"git://github.com/convenient/magento2-attribute-option-code.git","ssh_url":"git@github.com:convenient/magento2-attribute-option-code.git","clone_url":"https://github.com/convenient/magento2-attribute-option-code.git","svn_url":"https://github.com/convenient/magento2-attribute-option-code","homepage":null,"size":35,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"snowio:master","ref":"master","sha":"fa0ce257990b6af36686b4a3869d0ccc8fad38f1","user":{"login":"snowio","id":12641733,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEyNjQxNzMz","avatar_url":"https://avatars3.githubusercontent.com/u/12641733?v=4","gravatar_id":"","url":"https://api.github.com/users/snowio","html_url":"https://github.com/snowio","followers_url":"https://api.github.com/users/snowio/followers","following_url":"https://api.github.com/users/snowio/following{/other_user}","gists_url":"https://api.github.com/users/snowio/gists{/gist_id}","starred_url":"https://api.github.com/users/snowio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snowio/subscriptions","organizations_url":"https://api.github.com/users/snowio/orgs","repos_url":"https://api.github.com/users/snowio/repos","events_url":"https://api.github.com/users/snowio/events{/privacy}","received_events_url":"https://api.github.com/users/snowio/received_events","type":"Organization","site_admin":false},"repo":{"id":73280214,"node_id":"MDEwOlJlcG9zaXRvcnk3MzI4MDIxNA==","name":"magento2-attribute-option-code","full_name":"snowio/magento2-attribute-option-code","owner":{"login":"snowio","id":12641733,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEyNjQxNzMz","avatar_url":"https://avatars3.githubusercontent.com/u/12641733?v=4","gravatar_id":"","url":"https://api.github.com/users/snowio","html_url":"https://github.com/snowio","followers_url":"https://api.github.com/users/snowio/followers","following_url":"https://api.github.com/users/snowio/following{/other_user}","gists_url":"https://api.github.com/users/snowio/gists{/gist_id}","starred_url":"https://api.github.com/users/snowio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snowio/subscriptions","organizations_url":"https://api.github.com/users/snowio/orgs","repos_url":"https://api.github.com/users/snowio/repos","events_url":"https://api.github.com/users/snowio/events{/privacy}","received_events_url":"https://api.github.com/users/snowio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/snowio/magento2-attribute-option-code","description":null,"fork":false,"url":"https://api.github.com/repos/snowio/magento2-attribute-option-code","forks_url":"https://api.github.com/repos/snowio/magento2-attribute-option-code/forks","keys_url":"https://api.github.com/repos/snowio/magento2-attribute-option-code/keys{/key_id}","collaborators_url":"https://api.github.com/repos/snowio/magento2-attribute-option-code/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/snowio/magento2-attribute-option-code/teams","hooks_url":"https://api.github.com/repos/snowio/magento2-attribute-option-code/hooks","issue_events_url":"https://api.github.com/repos/snowio/magento2-attribute-option-code/issues/events{/number}","events_url":"https://api.github.com/repos/snowio/magento2-attribute-option-code/events","assignees_url":"https://api.github.com/repos/snowio/magento2-attribute-option-code/assignees{/user}","branches_url":"https://api.github.com/repos/snowio/magento2-attribute-option-code/branches{/branch}","tags_url":"https://api.github.com/repos/snowio/magento2-attribute-option-code/tags","blobs_url":"https://api.github.com/repos/snowio/magento2-attribute-option-code/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/snowio/magento2-attribute-option-code/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/snowio/magento2-attribute-option-code/git/refs{/sha}","trees_url":"https://api.github.com/repos/snowio/magento2-attribute-option-code/git/trees{/sha}","statuses_url":"https://api.github.com/repos/snowio/magento2-attribute-option-code/statuses/{sha}","languages_url":"https://api.github.com/repos/snowio/magento2-attribute-option-code/languages","stargazers_url":"https://api.github.com/repos/snowio/magento2-attribute-option-code/stargazers","contributors_url":"https://api.github.com/repos/snowio/magento2-attribute-option-code/contributors","subscribers_url":"https://api.github.com/repos/snowio/magento2-attribute-option-code/subscribers","subscription_url":"https://api.github.com/repos/snowio/magento2-attribute-option-code/subscription","commits_url":"https://api.github.com/repos/snowio/magento2-attribute-option-code/commits{/sha}","git_commits_url":"https://api.github.com/repos/snowio/magento2-attribute-option-code/git/commits{/sha}","comments_url":"https://api.github.com/repos/snowio/magento2-attribute-option-code/comments{/number}","issue_comment_url":"https://api.github.com/repos/snowio/magento2-attribute-option-code/issues/comments{/number}","contents_url":"https://api.github.com/repos/snowio/magento2-attribute-option-code/contents/{+path}","compare_url":"https://api.github.com/repos/snowio/magento2-attribute-option-code/compare/{base}...{head}","merges_url":"https://api.github.com/repos/snowio/magento2-attribute-option-code/merges","archive_url":"https://api.github.com/repos/snowio/magento2-attribute-option-code/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/snowio/magento2-attribute-option-code/downloads","issues_url":"https://api.github.com/repos/snowio/magento2-attribute-option-code/issues{/number}","pulls_url":"https://api.github.com/repos/snowio/magento2-attribute-option-code/pulls{/number}","milestones_url":"https://api.github.com/repos/snowio/magento2-attribute-option-code/milestones{/number}","notifications_url":"https://api.github.com/repos/snowio/magento2-attribute-option-code/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/snowio/magento2-attribute-option-code/labels{/name}","releases_url":"https://api.github.com/repos/snowio/magento2-attribute-option-code/releases{/id}","deployments_url":"https://api.github.com/repos/snowio/magento2-attribute-option-code/deployments","created_at":"2016-11-09T11:58:28Z","updated_at":"2018-05-21T09:08:07Z","pushed_at":"2018-08-10T13:44:25Z","git_url":"git://github.com/snowio/magento2-attribute-option-code.git","ssh_url":"git@github.com:snowio/magento2-attribute-option-code.git","clone_url":"https://github.com/snowio/magento2-attribute-option-code.git","svn_url":"https://github.com/snowio/magento2-attribute-option-code","homepage":null,"size":36,"stargazers_count":7,"watchers_count":7,"language":"PHP","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":4,"open_issues":1,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/snowio/magento2-attribute-option-code/pulls/8"},"html":{"href":"https://github.com/snowio/magento2-attribute-option-code/pull/8"},"issue":{"href":"https://api.github.com/repos/snowio/magento2-attribute-option-code/issues/8"},"comments":{"href":"https://api.github.com/repos/snowio/magento2-attribute-option-code/issues/8/comments"},"review_comments":{"href":"https://api.github.com/repos/snowio/magento2-attribute-option-code/pulls/8/comments"},"review_comment":{"href":"https://api.github.com/repos/snowio/magento2-attribute-option-code/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/snowio/magento2-attribute-option-code/pulls/8/commits"},"statuses":{"href":"https://api.github.com/repos/snowio/magento2-attribute-option-code/statuses/52e199b349a9315ebc25a516336628d36dcbd3d9"}},"author_association":"NONE"}}
{"actor":{"display_login":"convenient"}}