{"action":"created","comment":{"url":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/comments/29591353","id":29591353,"diff_hunk":"@@ -2,102 +2,102 @@\n \n namespace Pim\\Bundle\\DataGridBundle\\Controller;\n \n-use Pim\\Bundle\\CatalogBundle\\Context\\CatalogContext;\n-use Pim\\Bundle\\CatalogBundle\\Manager\\LocaleManager;\n-use Pim\\Bundle\\CatalogBundle\\Repository\\ProductRepositoryInterface;\n+use Pim\\Bundle\\BaseConnectorBundle\\JobLauncher\\SimpleJobLauncher;\n+use Pim\\Bundle\\DataGridBundle\\Adapter\\GridFilterAdapterInterface;\n use Pim\\Bundle\\DataGridBundle\\Extension\\MassAction\\MassActionDispatcher;\n-use Pim\\Bundle\\DataGridBundle\\Extension\\MassAction\\Util\\ProductFieldsBuilder;\n+use Pim\\Bundle\\ImportExportBundle\\Entity\\Repository\\JobInstanceRepository;\n use Symfony\\Component\\HttpFoundation\\Request;\n-use Symfony\\Component\\Serializer\\SerializerInterface;\n+use Symfony\\Component\\HttpFoundation\\Response;\n+use Symfony\\Component\\Security\\Core\\SecurityContextInterface;\n \n /**\n- * Override ExportController for product exports\n+ * Products quick export\n  *\n- * @author    Romain Monceau <romain@akeneo.com>\n- * @copyright 2013 Akeneo SAS (http://www.akeneo.com)\n+ * @author    Willy Mesnage <willy.mesnage@akeneo.com>\n+ * @copyright 2015 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 ProductExportController extends ExportController\n+class ProductExportController\n {\n-    /** @var ProductRepositoryInterface */\n-    protected $productRepository;\n+    /** @var Request */\n+    protected $request;\n \n-    /** @var LocaleManager */\n-    protected $localeManager;\n+    /** @var MassActionDispatcher */\n+    protected $massActionDispatcher;\n \n-    /** @var CatalogContext */\n-    protected $catalogContext;\n+    /** @var GridFilterAdapterInterface */\n+    protected $gridFilterAdapter;\n \n-    /** @var ProductFieldsBuilder */\n-    protected $fieldsBuilder;\n+    /** @var JobInstanceRepository */\n+    protected $jobInstanceRepository;\n+\n+    /** @var SecurityContextInterface */\n+    protected $securityContext;\n+\n+    /** @var SimpleJobLauncher */\n+    protected $jobLauncher;\n \n     /**\n-     * Constructor\n-     *\n      * @param Request                    $request\n      * @param MassActionDispatcher       $massActionDispatcher\n-     * @param SerializerInterface        $serializer\n-     * @param ProductRepositoryInterface $productRepository\n-     * @param LocaleManager              $localeManager\n-     * @param CatalogContext             $catalogContext\n-     * @param ProductFieldsBuilder       $fieldsBuilder\n+     * @param GridFilterAdapterInterface $gridFilterAdapter\n+     * @param JobInstanceRepository      $jobInstanceRepository\n+     * @param SecurityContextInterface   $securityContext\n+     * @param SimpleJobLauncher          $jobLauncher\n      */\n     public function __construct(\n         Request $request,\n         MassActionDispatcher $massActionDispatcher,\n-        SerializerInterface $serializer,\n-        ProductRepositoryInterface $productRepository,\n-        LocaleManager $localeManager,\n-        CatalogContext $catalogContext,\n-        ProductFieldsBuilder $fieldsBuilder\n+        GridFilterAdapterInterface $gridFilterAdapter,\n+        JobInstanceRepository $jobInstanceRepository,\n+        SecurityContextInterface $securityContext,\n+        SimpleJobLauncher $jobLauncher\n     ) {\n-        parent::__construct(\n-            $request,\n-            $massActionDispatcher,\n-            $serializer\n-        );\n-\n-        $this->productRepository = $productRepository;\n-        $this->localeManager     = $localeManager;\n-        $this->catalogContext    = $catalogContext;\n-        $this->fieldsBuilder     = $fieldsBuilder;\n+        $this->request               = $request;\n+        $this->massActionDispatcher  = $massActionDispatcher;\n+        $this->gridFilterAdapter     = $gridFilterAdapter;\n+        $this->jobInstanceRepository = $jobInstanceRepository;\n+        $this->securityContext       = $securityContext;\n+        $this->jobLauncher           = $jobLauncher;\n     }\n \n     /**\n-     * {@inheritdoc}\n+     * Launch the quick export\n+     *\n+     * @return Response\n      */\n-    protected function createFilename()\n+    public function indexAction()\n     {\n-        $dateTime = new \\DateTime();\n-\n-        return sprintf(\n-            'products_export_%s_%s_%s.%s',\n-            $this->catalogContext->getLocaleCode(),\n-            $this->catalogContext->getScopeCode(),\n-            $dateTime->format('Y-m-d_H-i-s'),\n-            $this->getFormat()\n+        $jobInstance = $this->jobInstanceRepository->findOneBy(['code' => 'csv_product_quick_export']);\n+        $filters     = $this->gridFilterAdapter->adapt($this->request);\n+        $mainContext = $filters['mainContext'];\n+        unset($filters['mainContext']);\n+        $rawConfiguration =","path":"src/Pim/Bundle/DataGridBundle/Controller/ProductExportController.php","position":123,"original_position":123,"commit_id":"48ab6f0bf5864b354b934e5373b2aca99d1dd977","original_commit_id":"48ab6f0bf5864b354b934e5373b2aca99d1dd977","user":{"login":"grena","id":301169,"avatar_url":"https://avatars.githubusercontent.com/u/301169?v=3","gravatar_id":"","url":"https://api.github.com/users/grena","html_url":"https://github.com/grena","followers_url":"https://api.github.com/users/grena/followers","following_url":"https://api.github.com/users/grena/following{/other_user}","gists_url":"https://api.github.com/users/grena/gists{/gist_id}","starred_url":"https://api.github.com/users/grena/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grena/subscriptions","organizations_url":"https://api.github.com/users/grena/orgs","repos_url":"https://api.github.com/users/grena/repos","events_url":"https://api.github.com/users/grena/events{/privacy}","received_events_url":"https://api.github.com/users/grena/received_events","type":"User","site_admin":false},"body":"```php\r\n        $rawConfiguration = addslashes(\r\n            json_encode(\r\n                ['filters' => $filters, 'mainContext' => $mainContext]\r\n            )\r\n        );\r\n```","created_at":"2015-05-04T15:02:02Z","updated_at":"2015-05-04T15:02:02Z","html_url":"https://github.com/akeneo/pim-community-dev/pull/2602#discussion_r29591353","pull_request_url":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/2602","_links":{"self":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/comments/29591353"},"html":{"href":"https://github.com/akeneo/pim-community-dev/pull/2602#discussion_r29591353"},"pull_request":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/2602"}}},"pull_request":{"url":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/2602","id":34638574,"html_url":"https://github.com/akeneo/pim-community-dev/pull/2602","diff_url":"https://github.com/akeneo/pim-community-dev/pull/2602.diff","patch_url":"https://github.com/akeneo/pim-community-dev/pull/2602.patch","issue_url":"https://api.github.com/repos/akeneo/pim-community-dev/issues/2602","number":2602,"state":"open","locked":false,"title":"PIM-3618: Quick export is done in backend thanks to reader/processor/writer","user":{"login":"willy-ahva","id":7206368,"avatar_url":"https://avatars.githubusercontent.com/u/7206368?v=3","gravatar_id":"","url":"https://api.github.com/users/willy-ahva","html_url":"https://github.com/willy-ahva","followers_url":"https://api.github.com/users/willy-ahva/followers","following_url":"https://api.github.com/users/willy-ahva/following{/other_user}","gists_url":"https://api.github.com/users/willy-ahva/gists{/gist_id}","starred_url":"https://api.github.com/users/willy-ahva/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/willy-ahva/subscriptions","organizations_url":"https://api.github.com/users/willy-ahva/orgs","repos_url":"https://api.github.com/users/willy-ahva/repos","events_url":"https://api.github.com/users/willy-ahva/events{/privacy}","received_events_url":"https://api.github.com/users/willy-ahva/received_events","type":"User","site_admin":false},"body":"| Q                    | A\r\n| -------------------- | ---\r\n| Bug fix?             | n\r\n| New feature?         | Oh yeah !\r\n| BC breaks?           | think no ...\r\n| CI currently passes? | good question\r\n| Tests pass?          | another good question\r\n| Scenarios pass?      | yet another good question\r\n| Checkstyle issues?*  | n\r\n| PMD issues?**        | n\r\n| Changelog updated?   | YES\r\n| Fixed tickets        | PIM-3618\r\n| DB schema updated?   | n\r\n| Migration script?    | n\r\n| Doc PR               |","created_at":"2015-05-04T13:48:38Z","updated_at":"2015-05-04T15:02:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3d0797fdb6651e16afd0a8baed82c937f3c6bff2","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/2602/commits","review_comments_url":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/2602/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/2602/comments","statuses_url":"https://api.github.com/repos/akeneo/pim-community-dev/statuses/48ab6f0bf5864b354b934e5373b2aca99d1dd977","head":{"label":"akeneo:PIM-3618","ref":"PIM-3618","sha":"48ab6f0bf5864b354b934e5373b2aca99d1dd977","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":"Akeneo PIM development repository","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}","created_at":"2012-08-10T09:27:26Z","updated_at":"2015-04-29T13:50:22Z","pushed_at":"2015-05-04T14:52:50Z","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://akeneo.com","size":165925,"stargazers_count":218,"watchers_count":218,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":111,"mirror_url":null,"open_issues_count":66,"forks":111,"open_issues":66,"watchers":218,"default_branch":"master"}},"base":{"label":"akeneo:feature/backend_process","ref":"feature/backend_process","sha":"b3641de2dc57fd1f4e42d7b16bd9529753313245","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":"Akeneo PIM development repository","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}","created_at":"2012-08-10T09:27:26Z","updated_at":"2015-04-29T13:50:22Z","pushed_at":"2015-05-04T14:52:50Z","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://akeneo.com","size":165925,"stargazers_count":218,"watchers_count":218,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":111,"mirror_url":null,"open_issues_count":66,"forks":111,"open_issues":66,"watchers":218,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/2602"},"html":{"href":"https://github.com/akeneo/pim-community-dev/pull/2602"},"issue":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/issues/2602"},"comments":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/issues/2602/comments"},"review_comments":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/2602/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/2602/commits"},"statuses":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/statuses/48ab6f0bf5864b354b934e5373b2aca99d1dd977"}}}}