{"action":"created","comment":{"url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/pulls/comments/43631863","id":43631863,"diff_hunk":"@@ -11,13 +13,50 @@\n  */\n class ImageValidator extends Validator\n {\n+    /** @var MediaUrlExtension */\n+    protected $mediaUrlExtension;\n+\n+    /** @var MediaManager */\n+    protected $mediaManager;\n+\n+    /**\n+     * Set media url extension\n+     *\n+     * @param MediaUrlExtension $mediaUrlExtension media url extension\n+     *\n+     * @return self\n+     */\n+    public function setMediaUrlExtension(MediaUrlExtension $mediaUrlExtension)\n+    {\n+        $this->mediaUrlExtension = $mediaUrlExtension;\n+\n+        return $this;\n+    }\n+\n+    /**\n+     * Set media manager\n+     *\n+     * @param MediaManager $mediaManager media manager\n+     *\n+     * @return self\n+     */\n+    public function setMediaManager(MediaManager $mediaManager)\n+    {\n+        $this->mediaManager = $mediaManager;\n+\n+        return $this;\n+    }\n+\n     /**\n      * {@inheritdoc}\n      */\n     public function validate($value, Constraint $constraint)\n     {\n         if ($value instanceof File && $value->getStatus() == File::STATUS_WAITING) {\n-            $imagePath = sys_get_temp_dir() . '/' . $value->getFilename();\n+            $imageUrl = $this->mediaUrlExtension->getMediaUrl($value->getFilename());\n+            $imagePath = $this->mediaManager->getTmpPath() . md5(microtime()) . $value->getFilename();\n+            file_put_contents($imagePath, $imageUrl);\n+\n             parent::validate($imagePath, $constraint);","path":"Validator/Constraints/ImageValidator.php","position":59,"original_position":59,"commit_id":"0e90569ed730506b59bf294b2a7175de26393ea9","original_commit_id":"0e90569ed730506b59bf294b2a7175de26393ea9","user":{"login":"kedrap","id":228109,"avatar_url":"https://avatars.githubusercontent.com/u/228109?v=3","gravatar_id":"","url":"https://api.github.com/users/kedrap","html_url":"https://github.com/kedrap","followers_url":"https://api.github.com/users/kedrap/followers","following_url":"https://api.github.com/users/kedrap/following{/other_user}","gists_url":"https://api.github.com/users/kedrap/gists{/gist_id}","starred_url":"https://api.github.com/users/kedrap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kedrap/subscriptions","organizations_url":"https://api.github.com/users/kedrap/orgs","repos_url":"https://api.github.com/users/kedrap/repos","events_url":"https://api.github.com/users/kedrap/events{/privacy}","received_events_url":"https://api.github.com/users/kedrap/received_events","type":"User","site_admin":false},"body":"Could you add something like 'delete' unused file?\r\n","created_at":"2015-11-02T14:19:27Z","updated_at":"2015-11-02T14:19:27Z","html_url":"https://github.com/Schibsted-Tech-Polska/stp.svd-media-bundle/pull/6#discussion_r43631863","pull_request_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/pulls/6","_links":{"self":{"href":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/pulls/comments/43631863"},"html":{"href":"https://github.com/Schibsted-Tech-Polska/stp.svd-media-bundle/pull/6#discussion_r43631863"},"pull_request":{"href":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/pulls/6","id":49433741,"html_url":"https://github.com/Schibsted-Tech-Polska/stp.svd-media-bundle/pull/6","diff_url":"https://github.com/Schibsted-Tech-Polska/stp.svd-media-bundle/pull/6.diff","patch_url":"https://github.com/Schibsted-Tech-Polska/stp.svd-media-bundle/pull/6.patch","issue_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/issues/6","number":6,"state":"open","locked":false,"title":"#2 Transform files immediately when upload action is called","user":{"login":"KamilWojciech","id":6637762,"avatar_url":"https://avatars.githubusercontent.com/u/6637762?v=3","gravatar_id":"","url":"https://api.github.com/users/KamilWojciech","html_url":"https://github.com/KamilWojciech","followers_url":"https://api.github.com/users/KamilWojciech/followers","following_url":"https://api.github.com/users/KamilWojciech/following{/other_user}","gists_url":"https://api.github.com/users/KamilWojciech/gists{/gist_id}","starred_url":"https://api.github.com/users/KamilWojciech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KamilWojciech/subscriptions","organizations_url":"https://api.github.com/users/KamilWojciech/orgs","repos_url":"https://api.github.com/users/KamilWojciech/repos","events_url":"https://api.github.com/users/KamilWojciech/events{/privacy}","received_events_url":"https://api.github.com/users/KamilWojciech/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-11-02T13:56:16Z","updated_at":"2015-11-02T14:19:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b1edeea6905b58ecb17c3f8cf51550650ff45ed2","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/pulls/6/commits","review_comments_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/pulls/6/comments","review_comment_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/issues/6/comments","statuses_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/statuses/0e90569ed730506b59bf294b2a7175de26393ea9","head":{"label":"Schibsted-Tech-Polska:#2","ref":"#2","sha":"0e90569ed730506b59bf294b2a7175de26393ea9","user":{"login":"Schibsted-Tech-Polska","id":4058593,"avatar_url":"https://avatars.githubusercontent.com/u/4058593?v=3","gravatar_id":"","url":"https://api.github.com/users/Schibsted-Tech-Polska","html_url":"https://github.com/Schibsted-Tech-Polska","followers_url":"https://api.github.com/users/Schibsted-Tech-Polska/followers","following_url":"https://api.github.com/users/Schibsted-Tech-Polska/following{/other_user}","gists_url":"https://api.github.com/users/Schibsted-Tech-Polska/gists{/gist_id}","starred_url":"https://api.github.com/users/Schibsted-Tech-Polska/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Schibsted-Tech-Polska/subscriptions","organizations_url":"https://api.github.com/users/Schibsted-Tech-Polska/orgs","repos_url":"https://api.github.com/users/Schibsted-Tech-Polska/repos","events_url":"https://api.github.com/users/Schibsted-Tech-Polska/events{/privacy}","received_events_url":"https://api.github.com/users/Schibsted-Tech-Polska/received_events","type":"Organization","site_admin":false},"repo":{"id":42048638,"name":"stp.svd-media-bundle","full_name":"Schibsted-Tech-Polska/stp.svd-media-bundle","owner":{"login":"Schibsted-Tech-Polska","id":4058593,"avatar_url":"https://avatars.githubusercontent.com/u/4058593?v=3","gravatar_id":"","url":"https://api.github.com/users/Schibsted-Tech-Polska","html_url":"https://github.com/Schibsted-Tech-Polska","followers_url":"https://api.github.com/users/Schibsted-Tech-Polska/followers","following_url":"https://api.github.com/users/Schibsted-Tech-Polska/following{/other_user}","gists_url":"https://api.github.com/users/Schibsted-Tech-Polska/gists{/gist_id}","starred_url":"https://api.github.com/users/Schibsted-Tech-Polska/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Schibsted-Tech-Polska/subscriptions","organizations_url":"https://api.github.com/users/Schibsted-Tech-Polska/orgs","repos_url":"https://api.github.com/users/Schibsted-Tech-Polska/repos","events_url":"https://api.github.com/users/Schibsted-Tech-Polska/events{/privacy}","received_events_url":"https://api.github.com/users/Schibsted-Tech-Polska/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Schibsted-Tech-Polska/stp.svd-media-bundle","description":"Svd media bundle","fork":false,"url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle","forks_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/forks","keys_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/teams","hooks_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/hooks","issue_events_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/issues/events{/number}","events_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/events","assignees_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/assignees{/user}","branches_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/branches{/branch}","tags_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/tags","blobs_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/git/refs{/sha}","trees_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/statuses/{sha}","languages_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/languages","stargazers_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/stargazers","contributors_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/contributors","subscribers_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/subscribers","subscription_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/subscription","commits_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/commits{/sha}","git_commits_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/git/commits{/sha}","comments_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/comments{/number}","issue_comment_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/issues/comments{/number}","contents_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/contents/{+path}","compare_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/merges","archive_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/downloads","issues_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/issues{/number}","pulls_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/pulls{/number}","milestones_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/milestones{/number}","notifications_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/labels{/name}","releases_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/releases{/id}","created_at":"2015-09-07T11:13:03Z","updated_at":"2015-10-26T10:03:46Z","pushed_at":"2015-11-02T14:07:56Z","git_url":"git://github.com/Schibsted-Tech-Polska/stp.svd-media-bundle.git","ssh_url":"git@github.com:Schibsted-Tech-Polska/stp.svd-media-bundle.git","clone_url":"https://github.com/Schibsted-Tech-Polska/stp.svd-media-bundle.git","svn_url":"https://github.com/Schibsted-Tech-Polska/stp.svd-media-bundle","homepage":null,"size":232,"stargazers_count":2,"watchers_count":2,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":2,"default_branch":"master"}},"base":{"label":"Schibsted-Tech-Polska:master","ref":"master","sha":"2673dfc13792c3931afd03f3c14deadf0447db5d","user":{"login":"Schibsted-Tech-Polska","id":4058593,"avatar_url":"https://avatars.githubusercontent.com/u/4058593?v=3","gravatar_id":"","url":"https://api.github.com/users/Schibsted-Tech-Polska","html_url":"https://github.com/Schibsted-Tech-Polska","followers_url":"https://api.github.com/users/Schibsted-Tech-Polska/followers","following_url":"https://api.github.com/users/Schibsted-Tech-Polska/following{/other_user}","gists_url":"https://api.github.com/users/Schibsted-Tech-Polska/gists{/gist_id}","starred_url":"https://api.github.com/users/Schibsted-Tech-Polska/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Schibsted-Tech-Polska/subscriptions","organizations_url":"https://api.github.com/users/Schibsted-Tech-Polska/orgs","repos_url":"https://api.github.com/users/Schibsted-Tech-Polska/repos","events_url":"https://api.github.com/users/Schibsted-Tech-Polska/events{/privacy}","received_events_url":"https://api.github.com/users/Schibsted-Tech-Polska/received_events","type":"Organization","site_admin":false},"repo":{"id":42048638,"name":"stp.svd-media-bundle","full_name":"Schibsted-Tech-Polska/stp.svd-media-bundle","owner":{"login":"Schibsted-Tech-Polska","id":4058593,"avatar_url":"https://avatars.githubusercontent.com/u/4058593?v=3","gravatar_id":"","url":"https://api.github.com/users/Schibsted-Tech-Polska","html_url":"https://github.com/Schibsted-Tech-Polska","followers_url":"https://api.github.com/users/Schibsted-Tech-Polska/followers","following_url":"https://api.github.com/users/Schibsted-Tech-Polska/following{/other_user}","gists_url":"https://api.github.com/users/Schibsted-Tech-Polska/gists{/gist_id}","starred_url":"https://api.github.com/users/Schibsted-Tech-Polska/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Schibsted-Tech-Polska/subscriptions","organizations_url":"https://api.github.com/users/Schibsted-Tech-Polska/orgs","repos_url":"https://api.github.com/users/Schibsted-Tech-Polska/repos","events_url":"https://api.github.com/users/Schibsted-Tech-Polska/events{/privacy}","received_events_url":"https://api.github.com/users/Schibsted-Tech-Polska/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Schibsted-Tech-Polska/stp.svd-media-bundle","description":"Svd media bundle","fork":false,"url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle","forks_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/forks","keys_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/teams","hooks_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/hooks","issue_events_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/issues/events{/number}","events_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/events","assignees_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/assignees{/user}","branches_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/branches{/branch}","tags_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/tags","blobs_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/git/refs{/sha}","trees_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/statuses/{sha}","languages_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/languages","stargazers_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/stargazers","contributors_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/contributors","subscribers_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/subscribers","subscription_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/subscription","commits_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/commits{/sha}","git_commits_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/git/commits{/sha}","comments_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/comments{/number}","issue_comment_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/issues/comments{/number}","contents_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/contents/{+path}","compare_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/merges","archive_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/downloads","issues_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/issues{/number}","pulls_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/pulls{/number}","milestones_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/milestones{/number}","notifications_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/labels{/name}","releases_url":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/releases{/id}","created_at":"2015-09-07T11:13:03Z","updated_at":"2015-10-26T10:03:46Z","pushed_at":"2015-11-02T14:07:56Z","git_url":"git://github.com/Schibsted-Tech-Polska/stp.svd-media-bundle.git","ssh_url":"git@github.com:Schibsted-Tech-Polska/stp.svd-media-bundle.git","clone_url":"https://github.com/Schibsted-Tech-Polska/stp.svd-media-bundle.git","svn_url":"https://github.com/Schibsted-Tech-Polska/stp.svd-media-bundle","homepage":null,"size":232,"stargazers_count":2,"watchers_count":2,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/pulls/6"},"html":{"href":"https://github.com/Schibsted-Tech-Polska/stp.svd-media-bundle/pull/6"},"issue":{"href":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/issues/6"},"comments":{"href":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/Schibsted-Tech-Polska/stp.svd-media-bundle/statuses/0e90569ed730506b59bf294b2a7175de26393ea9"}}}}