dnadesign / silverstripe-elemental-userforms

Adds a new element for usersforms
BSD 3-Clause "New" or "Revised" License
9 stars 16 forks source link

dev/build "Corrected default polymorphic class names" when fields are related to ElementForm #43

Open jakxnz opened 5 years ago

jakxnz commented 5 years ago

When a set of existing EditableFormFields are related to an ElementForm, running dev/build will "correct" the polymorphic relation to SilverStripe\UserForms\Model\UserDefinedForm and break the relationship.


Versions

dnadesign/silverstripe-elemental           4.1.0
dnadesign/silverstripe-elemental-userforms 3.0.0
silverstripe/userforms                     5.4.1

Steps to recreate

Expected result

Relationship between fields and ElementForm is preserved

Actual result

Relationship between fields and ElementForm is decoupled - fields are no longer visible in the CMS under the corresponding ElementForm.

dev/build's records output says:

Corrected {x} default polymorphic class names to SilverStripe\UserForms\Model\UserDefinedForm

EditableFormField polymorphic relation class (field ParentClass) value is switched from DNADesign\ElementalUserForms\Model\ElementForm to SilverStripe\UserForms\Model\UserDefinedForm

jakxnz commented 5 years ago

A workaround is to disable the UserForm module's UpgradePolymorphicExtension "Upgrade on build" behaviour, by assigning the following config:

SilverStripe\UserForms\Model\UserDefinedForm:
  upgrade_on_build: false
robbieaverill commented 5 years ago

Yep, that task was designed specifically for userforms when used with pages, during a SS3->SS4 upgrade. Disabling here is the right approach. Would you like to make a PR to the readme or documentation for this module to mention that?

chrispenny commented 4 years ago

Thanks for the fix, @jakxnz . I also just ran into this.

sukhwinder-somar commented 1 year ago

thanks @jakxnz, I also ran into this same issue