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

Add unit test scenarios for UnsavedRelationList #59

Closed
chrispenny opened this issue Oct 13, 2022 · 1 comment · Fixed by #77
Closed

Add unit test scenarios for UnsavedRelationList #59

chrispenny opened this issue Oct 13, 2022 · 1 comment · Fixed by #77
Labels
enhancement New feature or request

Comments

@chrispenny
Copy link
Member

Not entirely sure what triggers an UnsavedRelationList to exist. Will need to look into that. First guess is that it might be when an unsaved model is added to a DataList?

$model = NewModel::create();
// $model hasn't been saved yet
$page->Models()->add($model);
@chrispenny chrispenny added the enhancement New feature or request label Nov 21, 2022
@GuySartorelli
Copy link

I think it's the other side of the relation not being written yet which triggers this

$page = Page::create();
$page->Models()->add(SomeModel::get()->first()); // I think $page->Models() is an `UnsavedRelationList`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants