{"action":"created","comment":{"url":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/comments/65079264","id":65079264,"diff_hunk":"@@ -0,0 +1,163 @@\n+<?php\n+\n+namespace Pim\\Bundle\\ImportExportBundle\\Form\\Type\\JobParameter;\n+\n+use Akeneo\\Component\\Batch\\Job\\BatchStatus;\n+use Akeneo\\Component\\Batch\\Job\\JobRepositoryInterface;\n+use Akeneo\\Component\\Batch\\Model\\JobInstance;\n+use Akeneo\\Component\\Localization\\Factory\\DateFactory;\n+use Akeneo\\Component\\Localization\\Presenter\\PresenterInterface;\n+use Pim\\Bundle\\EnrichBundle\\Resolver\\LocaleResolver;\n+use Symfony\\Component\\Form\\AbstractType;\n+use Symfony\\Component\\Form\\FormBuilderInterface;\n+use Symfony\\Component\\Form\\FormInterface;\n+use Symfony\\Component\\Form\\FormView;\n+use Symfony\\Component\\OptionsResolver\\OptionsResolver;\n+use Symfony\\Component\\Translation\\TranslatorInterface;\n+use Symfony\\Component\\Validator\\Constraints\\Callback;\n+use Symfony\\Component\\Validator\\Context\\ExecutionContextInterface;\n+\n+/**\n+ * Updated time condition type use in export builder\n+ *\n+ * @author    Arnaud Langlade <arnaud.langlade@akeneo.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 UpdatedConditionType extends AbstractType\n+{\n+    /** @var JobRepositoryInterface */\n+    protected $jobRepository;\n+    \n+    /** @var TranslatorInterface */\n+    protected $translator;\n+    \n+    /** @var LocaleResolver */\n+    protected $localeResolver;\n+    \n+    /** @var PresenterInterface */\n+    protected $datePresenter;\n+\n+    /** @var DateFactory */\n+    protected $dateFactory;\n+\n+    /** @var string */\n+    protected $jobInstanceClass;\n+\n+    /**\n+     * @param JobRepositoryInterface $jobRepository\n+     * @param TranslatorInterface    $translator\n+     * @param LocaleResolver         $localeResolver\n+     * @param PresenterInterface     $datePresenter\n+     */\n+    public function __construct(\n+        JobRepositoryInterface $jobRepository,\n+        TranslatorInterface $translator,\n+        LocaleResolver $localeResolver,\n+        PresenterInterface $datePresenter,\n+        DateFactory $dateFactory,\n+        $jobInstanceClass\n+    ) {\n+        $this->jobRepository = $jobRepository;\n+        $this->translator = $translator;\n+        $this->localeResolver = $localeResolver;\n+        $this->datePresenter = $datePresenter;\n+        $this->dateFactory = $dateFactory;\n+        $this->jobInstanceClass = $jobInstanceClass;\n+    }\n+\n+    /**\n+     * {@inheritdoc}\n+     */\n+    public function buildForm(FormBuilderInterface $builder, array $options)\n+    {\n+        $dateFormatter = $this->dateFactory->create([\n+            'locale' => $this->localeResolver->getCurrentLocale(),\n+        ]);\n+\n+        $builder\n+            ->add('updated_condition', 'choice', [\n+                'choices' => [\n+                    'all'         => 'pim_connector.export.updated.updated_condition.choice.all',\n+                    'last_export' => 'pim_connector.export.updated.updated_condition.choice.last_export',\n+                    'since_date'  => 'pim_connector.export.updated.updated_condition.choice.since_date',\n+                ],\n+                'select2'  => true,\n+                'label'    => false,\n+            ])\n+            ->add('exported_since', 'datetime', [\n+                'widget' => 'single_text',\n+                'format' => $dateFormatter->getPattern(),\n+                'label'  => false,\n+                'input'  => 'string',\n+                'attr'   => [\n+                    'placeholder'  => 'pim_connector.export.updated.exported_since.placeholder',\n+                    'class'        => 'datepicker add-on input-large',\n+                    'autocomplete' => 'off',\n+                ],\n+                'constraints' => [\n+                    new Callback([\n+                        'callback' => function ($value, ExecutionContextInterface $context) use ($options) {\n+                            if (empty($value) &&\n+                                'since_date' === $options['job_instance']->getRawConfiguration()['updated_condition']) {\n+                                $context->buildViolation('pim_connector.export.updated.exported_since.error')\n+                                    ->atPath('exported_since')\n+                                    ->addViolation();\n+                            }\n+                        },\n+                    ])\n+                ]\n+            ])\n+        ;\n+    }\n+\n+    /**\n+     * {@inheritdoc}\n+     */\n+    public function buildView(FormView $view, FormInterface $form, array $options)\n+    {\n+        $view->vars['info'] = $this->getLastExecution($options['job_instance']);\n+    }\n+\n+    /**\n+     * {@inheritdoc}\n+     */\n+    public function configureOptions(OptionsResolver $resolver)\n+    {\n+        $resolver->setDefaults(['inherit_data' => true]);\n+        $resolver->setRequired(['job_instance']);\n+        $resolver->setAllowedTypes(['job_instance' => [$this->jobInstanceClass]]);\n+    }\n+\n+    /**\n+     * {@inheritdoc}\n+     */\n+    public function getName()\n+    {\n+        return 'pim_updated_parameter_type';\n+    }\n+    \n+    /**\n+     * Get last execution job\n+     *\n+     * @param JobInstance $jobInstance\n+     *\n+     * @return array\n+     */\n+    protected function getLastExecution(JobInstance $jobInstance)\n+    {\n+        $lastExecution = $this->jobRepository->getLastJobExecution($jobInstance, BatchStatus::COMPLETED);\n+\n+        if (null === $lastExecution) {\n+            return $this->translator->trans('pim_connector.export.updated.last_execution.none');\n+        }\n+\n+        $lastExecutionInfo = $this->translator->trans('pim_connector.export.updated.last_execution.last', [\n+            '%date%' => $this->datePresenter->present($lastExecution, [","path":"src/Pim/Bundle/ImportExportBundle/Form/Type/JobParameter/UpdatedConditionType.php","position":156,"original_position":156,"commit_id":"116c96fcb5196ec76c13b4491c4a1984ab7cda56","original_commit_id":"116c96fcb5196ec76c13b4491c4a1984ab7cda56","user":{"login":"aRn0D","id":3585922,"avatar_url":"https://avatars.githubusercontent.com/u/3585922?v=3","gravatar_id":"","url":"https://api.github.com/users/aRn0D","html_url":"https://github.com/aRn0D","followers_url":"https://api.github.com/users/aRn0D/followers","following_url":"https://api.github.com/users/aRn0D/following{/other_user}","gists_url":"https://api.github.com/users/aRn0D/gists{/gist_id}","starred_url":"https://api.github.com/users/aRn0D/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aRn0D/subscriptions","organizations_url":"https://api.github.com/users/aRn0D/orgs","repos_url":"https://api.github.com/users/aRn0D/repos","events_url":"https://api.github.com/users/aRn0D/events{/privacy}","received_events_url":"https://api.github.com/users/aRn0D/received_events","type":"User","site_admin":false},"body":"I don't understand","created_at":"2016-05-30T14:32:33Z","updated_at":"2016-05-30T14:32:33Z","html_url":"https://github.com/akeneo/pim-community-dev/pull/4508#discussion_r65079264","pull_request_url":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/4508","_links":{"self":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/comments/65079264"},"html":{"href":"https://github.com/akeneo/pim-community-dev/pull/4508#discussion_r65079264"},"pull_request":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/4508"}}},"pull_request":{"url":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/4508","id":71358773,"html_url":"https://github.com/akeneo/pim-community-dev/pull/4508","diff_url":"https://github.com/akeneo/pim-community-dev/pull/4508.diff","patch_url":"https://github.com/akeneo/pim-community-dev/pull/4508.patch","issue_url":"https://api.github.com/repos/akeneo/pim-community-dev/issues/4508","number":4508,"state":"open","locked":false,"title":"PIM-5431: export the products updated since a defined date","user":{"login":"aRn0D","id":3585922,"avatar_url":"https://avatars.githubusercontent.com/u/3585922?v=3","gravatar_id":"","url":"https://api.github.com/users/aRn0D","html_url":"https://github.com/aRn0D","followers_url":"https://api.github.com/users/aRn0D/followers","following_url":"https://api.github.com/users/aRn0D/following{/other_user}","gists_url":"https://api.github.com/users/aRn0D/gists{/gist_id}","starred_url":"https://api.github.com/users/aRn0D/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aRn0D/subscriptions","organizations_url":"https://api.github.com/users/aRn0D/orgs","repos_url":"https://api.github.com/users/aRn0D/repos","events_url":"https://api.github.com/users/aRn0D/events{/privacy}","received_events_url":"https://api.github.com/users/aRn0D/received_events","type":"User","site_admin":false},"body":"- [x] This option is added in the parameter \"Updated time condition\" (3rd option).\r\n- [ ] If this option is chosen, the input of the defined date is mandatory. If no date is input, the message \"Choose your date\" appears.\r\n- [x] Only the products created or updated since the defined date (time 00:00) are exported in the file.\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                  | TODO\r\n| Micro Demo to the PO (Story only) | TODO\r\n| Migration script                  | no\r\n| Tech Doc                          | no\r\n\r\n","created_at":"2016-05-25T09:36:43Z","updated_at":"2016-05-30T14:32:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"601b8cb5ae747012e0a44039240f9eaceb9001b7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/4508/commits","review_comments_url":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/4508/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/4508/comments","statuses_url":"https://api.github.com/repos/akeneo/pim-community-dev/statuses/116c96fcb5196ec76c13b4491c4a1984ab7cda56","head":{"label":"akeneo:PIM-5431","ref":"PIM-5431","sha":"116c96fcb5196ec76c13b4491c4a1984ab7cda56","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-05-24T22:23:05Z","pushed_at":"2016-05-30T14:27:02Z","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":145144,"stargazers_count":312,"watchers_count":312,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":158,"mirror_url":null,"open_issues_count":105,"forks":158,"open_issues":105,"watchers":312,"default_branch":"master"}},"base":{"label":"akeneo:master","ref":"master","sha":"cc4832b1a470e1f14c46038652475cee01244f86","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-05-24T22:23:05Z","pushed_at":"2016-05-30T14:27:02Z","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":145144,"stargazers_count":312,"watchers_count":312,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":158,"mirror_url":null,"open_issues_count":105,"forks":158,"open_issues":105,"watchers":312,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/4508"},"html":{"href":"https://github.com/akeneo/pim-community-dev/pull/4508"},"issue":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/issues/4508"},"comments":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/issues/4508/comments"},"review_comments":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/pulls/4508/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/4508/commits"},"statuses":{"href":"https://api.github.com/repos/akeneo/pim-community-dev/statuses/116c96fcb5196ec76c13b4491c4a1984ab7cda56"}}}}
{"actor":{"display_login":"aRn0D"}}