silverstripe / silverstripe-gridfieldqueuedexport

Export large data sets from your GridField in the Silverstripe CMS interface through async jobs
MIT License
10 stars 25 forks source link

Erroring with elemental-userforms #80

Closed dizzystuff closed 1 year ago

dizzystuff commented 1 year ago

Apologies in advance, I don't have the specific scenario that caused the error, but I do have the simple fix! While doing SS5 upgrades and reviews, I'm PR'ing back what I can as I go.

Basically updateCMSFields in UserFormUseQueuedExportExtension.php is expecting $gridField = $fields->fieldByName('Root.Submissions.Submissions'); to always return a valid gridfield.

When I use this module along with elemental-userforms, in some scenario (which I can't recall - but I think is as commonplace as on creation of the userforms element) the Root.Submissions.Submissions gridfield doesn't exist, so when $gridField->getConfig() is called on null, an error is thrown.

I'm going to submit a PR, ideally could we just add if (empty($gridField)) return; between the two lines?

I can do more homework here, I'm just hoping that it's enough of a commonsense edit that you don't need me to 😅

PRs