-
Notifications
You must be signed in to change notification settings - Fork 225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UserFormFileExtension #964
UserFormFileExtension #964
Conversation
5d36f68
to
dbffbca
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of suggestions, but otherwise looking good. I've recommended an adjustment to the naming of the new API this relies on, so I'll hold off on approving this until that's resolved and this PR is updated (if necessary).
1942d18
to
dc2c157
Compare
dc2c157
to
37e6439
Compare
Something about this approach feels off. Why aren't we using the pre-existing relationship between if ($file->UploadField()->exists()) {
return true;
} All this would need is to add a config value of: SilverStripe\Assets\File:
belongs_to:
UploadField: SilverStripe\UserForms\Model\Submission\SubmittedFileField |
5835597
to
e6ee32d
Compare
@dhensby have updated to use |
2797dfd
to
dbbb02a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've provided some additional thoughts on Dan's outstanding feedback, but basically I think this is good to go now.
@emteknetnz Take a quick look at the second one and see if you agree with my suggestion, otherwise let's merge.
dbbb02a
to
2d3f95c
Compare
- UserFormUpload used by File::isTrackedFormUpload()
2d3f95c
to
ed53709
Compare
My overall point here is why are we adding a new field that de-normalises this information when it can be worked out from existing database relationships. We know which files were uploaded from formfields by seeing if there is a relationship with an EditableFormField. We can replace all this entire PR with: public function getUserFormUpload() {
return $value = $file->SubmittedFileField()->exists();
} |
The correct way to do it would be to use |
Extension method implementation to check if a file is a userform file upload
Related PR: silverstripe/silverstripe-assets#398
Issue silverstripe/silverstripe-asset-admin#1066