{"action":"created","issue":{"url":"https://api.github.com/repos/magento/magento2/issues/18286","repository_url":"https://api.github.com/repos/magento/magento2","labels_url":"https://api.github.com/repos/magento/magento2/issues/18286/labels{/name}","comments_url":"https://api.github.com/repos/magento/magento2/issues/18286/comments","events_url":"https://api.github.com/repos/magento/magento2/issues/18286/events","html_url":"https://github.com/magento/magento2/pull/18286","id":364465006,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE4NjQzNDg0","number":18286,"title":"Fixed issue with product copy outside of admin area","user":{"login":"tomasinchoo","id":1217464,"node_id":"MDQ6VXNlcjEyMTc0NjQ=","avatar_url":"https://avatars2.githubusercontent.com/u/1217464?v=4","gravatar_id":"","url":"https://api.github.com/users/tomasinchoo","html_url":"https://github.com/tomasinchoo","followers_url":"https://api.github.com/users/tomasinchoo/followers","following_url":"https://api.github.com/users/tomasinchoo/following{/other_user}","gists_url":"https://api.github.com/users/tomasinchoo/gists{/gist_id}","starred_url":"https://api.github.com/users/tomasinchoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomasinchoo/subscriptions","organizations_url":"https://api.github.com/users/tomasinchoo/orgs","repos_url":"https://api.github.com/users/tomasinchoo/repos","events_url":"https://api.github.com/users/tomasinchoo/events{/privacy}","received_events_url":"https://api.github.com/users/tomasinchoo/received_events","type":"User","site_admin":false},"labels":[{"id":374038437,"node_id":"MDU6TGFiZWwzNzQwMzg0Mzc=","url":"https://api.github.com/repos/magento/magento2/labels/Component:%20Catalog","name":"Component: Catalog","color":"7fb703","default":false},{"id":963189849,"node_id":"MDU6TGFiZWw5NjMxODk4NDk=","url":"https://api.github.com/repos/magento/magento2/labels/Component:%20CatalogInventory","name":"Component: CatalogInventory","color":"7fb703","default":false},{"id":972500573,"node_id":"MDU6TGFiZWw5NzI1MDA1NzM=","url":"https://api.github.com/repos/magento/magento2/labels/Component:%20Downloadable","name":"Component: Downloadable","color":"7fb703","default":false},{"id":1071130788,"node_id":"MDU6TGFiZWwxMDcxMTMwNzg4","url":"https://api.github.com/repos/magento/magento2/labels/Event:%20mm18hr","name":"Event: mm18hr","color":"ededed","default":false},{"id":703232382,"node_id":"MDU6TGFiZWw3MDMyMzIzODI=","url":"https://api.github.com/repos/magento/magento2/labels/Release%20Line:%202.2","name":"Release Line: 2.2","color":"fbca04","default":false}],"state":"closed","locked":false,"assignee":{"login":"orlangur","id":642698,"node_id":"MDQ6VXNlcjY0MjY5OA==","avatar_url":"https://avatars2.githubusercontent.com/u/642698?v=4","gravatar_id":"","url":"https://api.github.com/users/orlangur","html_url":"https://github.com/orlangur","followers_url":"https://api.github.com/users/orlangur/followers","following_url":"https://api.github.com/users/orlangur/following{/other_user}","gists_url":"https://api.github.com/users/orlangur/gists{/gist_id}","starred_url":"https://api.github.com/users/orlangur/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/orlangur/subscriptions","organizations_url":"https://api.github.com/users/orlangur/orgs","repos_url":"https://api.github.com/users/orlangur/repos","events_url":"https://api.github.com/users/orlangur/events{/privacy}","received_events_url":"https://api.github.com/users/orlangur/received_events","type":"User","site_admin":false},"assignees":[{"login":"orlangur","id":642698,"node_id":"MDQ6VXNlcjY0MjY5OA==","avatar_url":"https://avatars2.githubusercontent.com/u/642698?v=4","gravatar_id":"","url":"https://api.github.com/users/orlangur","html_url":"https://github.com/orlangur","followers_url":"https://api.github.com/users/orlangur/followers","following_url":"https://api.github.com/users/orlangur/following{/other_user}","gists_url":"https://api.github.com/users/orlangur/gists{/gist_id}","starred_url":"https://api.github.com/users/orlangur/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/orlangur/subscriptions","organizations_url":"https://api.github.com/users/orlangur/orgs","repos_url":"https://api.github.com/users/orlangur/repos","events_url":"https://api.github.com/users/orlangur/events{/privacy}","received_events_url":"https://api.github.com/users/orlangur/received_events","type":"User","site_admin":false}],"milestone":null,"comments":6,"created_at":"2018-09-27T13:00:48Z","updated_at":"2018-11-07T05:10:22Z","closed_at":"2018-11-07T05:10:22Z","author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/magento/magento2/pulls/18286","html_url":"https://github.com/magento/magento2/pull/18286","diff_url":"https://github.com/magento/magento2/pull/18286.diff","patch_url":"https://github.com/magento/magento2/pull/18286.patch"},"body":"### Summary:\r\nError when using  `Magento\\Catalog\\Model\\Product\\Copier::copy() ` anywhere else than in admin area.\r\n\r\n### Description\r\n`<type name=\"Magento\\Catalog\\Model\\Product\\CopyConstructor\\Composite\">...</type>`\r\nand \r\n`<type name=\"Magento\\Catalog\\Model\\Product\\Copier\">...</type>`\r\ndefinitions were defined only in adminhtml/di.xml in Catalog, Downloadable and CatalogInventory modules.\r\nThat caused error to be thrown in case `Magento\\Catalog\\Model\\Product\\Copier::copy() ` is used anywhere else (frontend/console) than admin area.\r\nError thrown is:\r\n```( ! ) Fatal error: Uncaught Error: Cannot instantiate interface Magento\\Catalog\\Model\\Product\\CopyConstructorInterface in /var/www/html/lib/internal/Magento/Framework/ObjectManager/Factory/Dynamic/Developer.php on line 52```\r\n\r\nExample is that one is not able to run custom controller like the following:\r\n\r\n```\r\nnamespace Inchoo\\Copy\\Controller\\Test;\r\n\r\nuse Magento\\Framework\\App\\Action\\Action;\r\nuse Magento\\Framework\\App\\Action\\Context;\r\nuse Magento\\Catalog\\Model\\Product\\Copier;\r\nuse Magento\\Framework\\Exception\\NoSuchEntityException;\r\n\r\nclass Test extends Action\r\n{\r\n    public $copier;\r\n    public $productRepository;\r\n    const TEST_PRODUCT_ID = 1;\r\n\r\n    public function __construct(\r\n        Context $context,\r\n        Copier $copier,\r\n        \\Magento\\Catalog\\Api\\ProductRepositoryInterface $productRepository\r\n    ) {\r\n        $this->copier = $copier;\r\n        $this->productRepository = $productRepository;\r\n\r\n        parent::__construct($context);\r\n    }\r\n\r\n    public function execute()\r\n    {\r\n        try {\r\n            $product = $this->productRepository->getById(self::TEST_PRODUCT_ID);\r\n        } catch (NoSuchEntityException $e) {\r\n            die($e->getMessage());\r\n        }\r\n\r\n        $copier = $this->copier;\r\n        $copier->copy($product);\r\n    }\r\n}\r\n```\r\n\r\n### Fixed Issues (if relevant)\r\n[https://github.com/magento/magento2/issues/7056](https://github.com/magento/magento2/issues/7056)\r\n\r\n### Manual testing scenarios\r\n1. To make sure that existing functionality still works, just try to use Save and Duplicate option on admin product page.\r\n2. To make sure it now works on frontend, code mentioned in description should not throw mentioned errors. It should duplicate product instead.\r\n"},"comment":{"url":"https://api.github.com/repos/magento/magento2/issues/comments/436506809","html_url":"https://github.com/magento/magento2/pull/18286#issuecomment-436506809","issue_url":"https://api.github.com/repos/magento/magento2/issues/18286","id":436506809,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNjUwNjgwOQ==","user":{"login":"orlangur","id":642698,"node_id":"MDQ6VXNlcjY0MjY5OA==","avatar_url":"https://avatars2.githubusercontent.com/u/642698?v=4","gravatar_id":"","url":"https://api.github.com/users/orlangur","html_url":"https://github.com/orlangur","followers_url":"https://api.github.com/users/orlangur/followers","following_url":"https://api.github.com/users/orlangur/following{/other_user}","gists_url":"https://api.github.com/users/orlangur/gists{/gist_id}","starred_url":"https://api.github.com/users/orlangur/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/orlangur/subscriptions","organizations_url":"https://api.github.com/users/orlangur/orgs","repos_url":"https://api.github.com/users/orlangur/repos","events_url":"https://api.github.com/users/orlangur/events{/privacy}","received_events_url":"https://api.github.com/users/orlangur/received_events","type":"User","site_admin":false},"created_at":"2018-11-07T05:10:22Z","updated_at":"2018-11-07T05:10:22Z","author_association":"CONTRIBUTOR","body":"Closing due to inactivity. Feel free to reach me out anytime later if you wish to continue work on this pull request and it will be reopened.\r\nThanks for collaboration!"}}
{"actor":{"display_login":"orlangur"}}