{"action":"opened","number":1342,"pull_request":{"url":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/pulls/1342","id":38453958,"html_url":"https://github.com/Atlantic18/DoctrineExtensions/pull/1342","diff_url":"https://github.com/Atlantic18/DoctrineExtensions/pull/1342.diff","patch_url":"https://github.com/Atlantic18/DoctrineExtensions/pull/1342.patch","issue_url":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/issues/1342","number":1342,"state":"open","locked":false,"title":"Add multiple uploadables feature","user":{"login":"tamcy","id":959433,"avatar_url":"https://avatars.githubusercontent.com/u/959433?v=3","gravatar_id":"","url":"https://api.github.com/users/tamcy","html_url":"https://github.com/tamcy","followers_url":"https://api.github.com/users/tamcy/followers","following_url":"https://api.github.com/users/tamcy/following{/other_user}","gists_url":"https://api.github.com/users/tamcy/gists{/gist_id}","starred_url":"https://api.github.com/users/tamcy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tamcy/subscriptions","organizations_url":"https://api.github.com/users/tamcy/orgs","repos_url":"https://api.github.com/users/tamcy/repos","events_url":"https://api.github.com/users/tamcy/events{/privacy}","received_events_url":"https://api.github.com/users/tamcy/received_events","type":"User","site_admin":false},"body":"Ref: #961 \r\n\r\nThis changeset adds multiple uploadables support in a single entity. \r\n\r\n* A new `identifier` property is added to all annotations in the uploadable familty (`@Uploadable`\r\n`@UploadableFileMimeType`, `@UploadableFileName`, `@UploadableFilePath`, and `@UploadableFileSize`), with a default value `_default`. This ensures that no code change is needed in single upload situation.\r\n* A new `@Uploadables` annotation added to support multiple uploadable behavior.\r\n\r\nThe bad thing is I only added multiple support to annotation (I probably don't have spare time to write and test the yml and xml config, so need external help). The good thing is the original configuration won't break.\r\n\r\nHowever there are cases of potential bc-break:\r\n\r\n- A new parameter `identifier` is also added to `FilenameGeneratorInterface::generate()` as the forth argument. Currently this is used by the `FilenameGeneratorSha1` class to prevent having the same SHA1 result when the same filename and extension are passed to different file fields (with different identifiers) in the same entity. This may affect users who implements their own `FilenameGeneratorInterface`.\r\n- Visibility of method `processFile()` and `moveFile()` in `UploadableListener`  changed from `public` to `protected` because their signature are changed and they don't look right to be public. This may affect users who override the original `UploadableListener`.\r\n\r\nFinally, not related to this project, but still worth mentioning is that a change to stof's [DoctrineExtensionsBundle](https://github.com/stof/StofDoctrineExtensionsBundle/) is also needed to support multiple uploadables in a single entity. Modify the `markEntityToUpload()` method of  `\\Stof\\DoctrineExtensionsBundle\\Uploadable\\UploadableManager` as below:\r\n\r\n```php\r\n    public function markEntityToUpload($entity, $fileInfo, $identifier = '_default')\r\n    {\r\n        if (is_object($fileInfo) && $fileInfo instanceof UploadedFile) {\r\n            $fileInfoClass = $this->fileInfoClass;\r\n\r\n            $fileInfo = new $fileInfoClass($fileInfo);\r\n        }\r\n\r\n        $this->listener->addEntityFileInfo($entity, $fileInfo, $identifier);\r\n    }\r\n\r\n```\r\n\r\nUsage of this method will become:\r\n```php\r\n$manager->markEntityToUpload($file, $uploadedFile, 'image_thumb');\r\n```\r\n\r\n","created_at":"2015-06-24T15:23:15Z","updated_at":"2015-06-24T15:23:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/pulls/1342/commits","review_comments_url":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/pulls/1342/comments","review_comment_url":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/issues/1342/comments","statuses_url":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/statuses/42fae5b8e2f422fa28dbaaae9a86911fb73ad8e4","head":{"label":"tamcy:pull-req-1","ref":"pull-req-1","sha":"42fae5b8e2f422fa28dbaaae9a86911fb73ad8e4","user":{"login":"tamcy","id":959433,"avatar_url":"https://avatars.githubusercontent.com/u/959433?v=3","gravatar_id":"","url":"https://api.github.com/users/tamcy","html_url":"https://github.com/tamcy","followers_url":"https://api.github.com/users/tamcy/followers","following_url":"https://api.github.com/users/tamcy/following{/other_user}","gists_url":"https://api.github.com/users/tamcy/gists{/gist_id}","starred_url":"https://api.github.com/users/tamcy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tamcy/subscriptions","organizations_url":"https://api.github.com/users/tamcy/orgs","repos_url":"https://api.github.com/users/tamcy/repos","events_url":"https://api.github.com/users/tamcy/events{/privacy}","received_events_url":"https://api.github.com/users/tamcy/received_events","type":"User","site_admin":false},"repo":{"id":36924335,"name":"DoctrineExtensions","full_name":"tamcy/DoctrineExtensions","owner":{"login":"tamcy","id":959433,"avatar_url":"https://avatars.githubusercontent.com/u/959433?v=3","gravatar_id":"","url":"https://api.github.com/users/tamcy","html_url":"https://github.com/tamcy","followers_url":"https://api.github.com/users/tamcy/followers","following_url":"https://api.github.com/users/tamcy/following{/other_user}","gists_url":"https://api.github.com/users/tamcy/gists{/gist_id}","starred_url":"https://api.github.com/users/tamcy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tamcy/subscriptions","organizations_url":"https://api.github.com/users/tamcy/orgs","repos_url":"https://api.github.com/users/tamcy/repos","events_url":"https://api.github.com/users/tamcy/events{/privacy}","received_events_url":"https://api.github.com/users/tamcy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tamcy/DoctrineExtensions","description":"Doctrine2 behavioral extensions, Translatable, Sluggable, Tree-NestedSet, Timestampable, Loggable, Sortable","fork":true,"url":"https://api.github.com/repos/tamcy/DoctrineExtensions","forks_url":"https://api.github.com/repos/tamcy/DoctrineExtensions/forks","keys_url":"https://api.github.com/repos/tamcy/DoctrineExtensions/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tamcy/DoctrineExtensions/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tamcy/DoctrineExtensions/teams","hooks_url":"https://api.github.com/repos/tamcy/DoctrineExtensions/hooks","issue_events_url":"https://api.github.com/repos/tamcy/DoctrineExtensions/issues/events{/number}","events_url":"https://api.github.com/repos/tamcy/DoctrineExtensions/events","assignees_url":"https://api.github.com/repos/tamcy/DoctrineExtensions/assignees{/user}","branches_url":"https://api.github.com/repos/tamcy/DoctrineExtensions/branches{/branch}","tags_url":"https://api.github.com/repos/tamcy/DoctrineExtensions/tags","blobs_url":"https://api.github.com/repos/tamcy/DoctrineExtensions/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tamcy/DoctrineExtensions/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tamcy/DoctrineExtensions/git/refs{/sha}","trees_url":"https://api.github.com/repos/tamcy/DoctrineExtensions/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tamcy/DoctrineExtensions/statuses/{sha}","languages_url":"https://api.github.com/repos/tamcy/DoctrineExtensions/languages","stargazers_url":"https://api.github.com/repos/tamcy/DoctrineExtensions/stargazers","contributors_url":"https://api.github.com/repos/tamcy/DoctrineExtensions/contributors","subscribers_url":"https://api.github.com/repos/tamcy/DoctrineExtensions/subscribers","subscription_url":"https://api.github.com/repos/tamcy/DoctrineExtensions/subscription","commits_url":"https://api.github.com/repos/tamcy/DoctrineExtensions/commits{/sha}","git_commits_url":"https://api.github.com/repos/tamcy/DoctrineExtensions/git/commits{/sha}","comments_url":"https://api.github.com/repos/tamcy/DoctrineExtensions/comments{/number}","issue_comment_url":"https://api.github.com/repos/tamcy/DoctrineExtensions/issues/comments{/number}","contents_url":"https://api.github.com/repos/tamcy/DoctrineExtensions/contents/{+path}","compare_url":"https://api.github.com/repos/tamcy/DoctrineExtensions/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tamcy/DoctrineExtensions/merges","archive_url":"https://api.github.com/repos/tamcy/DoctrineExtensions/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tamcy/DoctrineExtensions/downloads","issues_url":"https://api.github.com/repos/tamcy/DoctrineExtensions/issues{/number}","pulls_url":"https://api.github.com/repos/tamcy/DoctrineExtensions/pulls{/number}","milestones_url":"https://api.github.com/repos/tamcy/DoctrineExtensions/milestones{/number}","notifications_url":"https://api.github.com/repos/tamcy/DoctrineExtensions/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tamcy/DoctrineExtensions/labels{/name}","releases_url":"https://api.github.com/repos/tamcy/DoctrineExtensions/releases{/id}","created_at":"2015-06-05T09:31:34Z","updated_at":"2015-06-05T09:31:36Z","pushed_at":"2015-06-24T15:09:07Z","git_url":"git://github.com/tamcy/DoctrineExtensions.git","ssh_url":"git@github.com:tamcy/DoctrineExtensions.git","clone_url":"https://github.com/tamcy/DoctrineExtensions.git","svn_url":"https://github.com/tamcy/DoctrineExtensions","homepage":"http://www.gediminasm.org","size":6333,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Atlantic18:master","ref":"master","sha":"68aa09eb4823765c34716ae2f8d14ffb4ddf09a7","user":{"login":"Atlantic18","id":6543086,"avatar_url":"https://avatars.githubusercontent.com/u/6543086?v=3","gravatar_id":"","url":"https://api.github.com/users/Atlantic18","html_url":"https://github.com/Atlantic18","followers_url":"https://api.github.com/users/Atlantic18/followers","following_url":"https://api.github.com/users/Atlantic18/following{/other_user}","gists_url":"https://api.github.com/users/Atlantic18/gists{/gist_id}","starred_url":"https://api.github.com/users/Atlantic18/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Atlantic18/subscriptions","organizations_url":"https://api.github.com/users/Atlantic18/orgs","repos_url":"https://api.github.com/users/Atlantic18/repos","events_url":"https://api.github.com/users/Atlantic18/events{/privacy}","received_events_url":"https://api.github.com/users/Atlantic18/received_events","type":"Organization","site_admin":false},"repo":{"id":885517,"name":"DoctrineExtensions","full_name":"Atlantic18/DoctrineExtensions","owner":{"login":"Atlantic18","id":6543086,"avatar_url":"https://avatars.githubusercontent.com/u/6543086?v=3","gravatar_id":"","url":"https://api.github.com/users/Atlantic18","html_url":"https://github.com/Atlantic18","followers_url":"https://api.github.com/users/Atlantic18/followers","following_url":"https://api.github.com/users/Atlantic18/following{/other_user}","gists_url":"https://api.github.com/users/Atlantic18/gists{/gist_id}","starred_url":"https://api.github.com/users/Atlantic18/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Atlantic18/subscriptions","organizations_url":"https://api.github.com/users/Atlantic18/orgs","repos_url":"https://api.github.com/users/Atlantic18/repos","events_url":"https://api.github.com/users/Atlantic18/events{/privacy}","received_events_url":"https://api.github.com/users/Atlantic18/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Atlantic18/DoctrineExtensions","description":"Doctrine2 behavioral extensions, Translatable, Sluggable, Tree-NestedSet, Timestampable, Loggable, Sortable","fork":false,"url":"https://api.github.com/repos/Atlantic18/DoctrineExtensions","forks_url":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/forks","keys_url":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/teams","hooks_url":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/hooks","issue_events_url":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/issues/events{/number}","events_url":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/events","assignees_url":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/assignees{/user}","branches_url":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/branches{/branch}","tags_url":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/tags","blobs_url":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/git/refs{/sha}","trees_url":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/statuses/{sha}","languages_url":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/languages","stargazers_url":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/stargazers","contributors_url":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/contributors","subscribers_url":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/subscribers","subscription_url":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/subscription","commits_url":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/commits{/sha}","git_commits_url":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/git/commits{/sha}","comments_url":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/comments{/number}","issue_comment_url":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/issues/comments{/number}","contents_url":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/contents/{+path}","compare_url":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/merges","archive_url":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/downloads","issues_url":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/issues{/number}","pulls_url":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/pulls{/number}","milestones_url":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/milestones{/number}","notifications_url":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/labels{/name}","releases_url":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/releases{/id}","created_at":"2010-09-03T12:08:12Z","updated_at":"2015-06-24T10:12:16Z","pushed_at":"2015-06-23T15:25:10Z","git_url":"git://github.com/Atlantic18/DoctrineExtensions.git","ssh_url":"git@github.com:Atlantic18/DoctrineExtensions.git","clone_url":"https://github.com/Atlantic18/DoctrineExtensions.git","svn_url":"https://github.com/Atlantic18/DoctrineExtensions","homepage":"http://www.gediminasm.org","size":11585,"stargazers_count":1323,"watchers_count":1323,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":636,"mirror_url":null,"open_issues_count":328,"forks":636,"open_issues":328,"watchers":1323,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/pulls/1342"},"html":{"href":"https://github.com/Atlantic18/DoctrineExtensions/pull/1342"},"issue":{"href":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/issues/1342"},"comments":{"href":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/issues/1342/comments"},"review_comments":{"href":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/pulls/1342/comments"},"review_comment":{"href":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/pulls/1342/commits"},"statuses":{"href":"https://api.github.com/repos/Atlantic18/DoctrineExtensions/statuses/42fae5b8e2f422fa28dbaaae9a86911fb73ad8e4"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":6,"additions":448,"deletions":90,"changed_files":15}}