Skip to content
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

Handle cases where relationship is UnsavedRelationList #58

Conversation

monkeyfeet
Copy link
Contributor

When saving a DO, type error is thrown if one of the relationships is an UnsavedRalationList (expects DataList). This change introduces a check for instance of DataList before processing the relations.

…s param, check if DO is in database before processing in updateInatance()
@chrispenny
Copy link
Member

After some discussion, we were a little unclear when/what triggers an UnsavedRelationList to be used. We initially attempted to add a condition to not process lists that were not specifically a DataList, but this seemed to have issues with our tests (and perhaps the way that fixtures scaffold records?).

It seems like a reasonable solution would be to loosen the requirement on updateInstances() to allow any type of SS_List (includes DataList, ArrayList, and UnsavedRelationList), and to instead make sure that all records are inDB() as part of the processInstance() method.

@chrispenny chrispenny merged commit f54d23d into silverstripe-terraformers:main Oct 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants