Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Ref: #961
This changeset adds multiple uploadables support in a single entity.
identifier
property is added to all annotations in the uploadable familty (@Uploadable
@UploadableFileMimeType
,@UploadableFileName
,@UploadableFilePath
, and@UploadableFileSize
), with a default value_default
. This ensures that no code change is needed in single upload situation.@Uploadables
annotation added to support multiple uploadable behavior.The 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.
However there are cases of potential bc-break:
identifier
is also added toFilenameGeneratorInterface::generate()
as the forth argument. Currently this is used by theFilenameGeneratorSha1
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 ownFilenameGeneratorInterface
.processFile()
andmoveFile()
inUploadableListener
changed frompublic
toprotected
because their signature are changed and they don't look right to be public. This may affect users who override the originalUploadableListener
.Finally, not related to this project, but still worth mentioning is that a change to stof's DoctrineExtensionsBundle is also needed to support multiple uploadables in a single entity. Modify the
markEntityToUpload()
method of\Stof\DoctrineExtensionsBundle\Uploadable\UploadableManager
as below:Usage of this method will become: