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

updateRecursive and safeUpdateRecursive cannot contain CollectionOfJsonModels in path #13

Open
jwadhams opened this issue Nov 25, 2024 · 0 comments

Comments

@jwadhams
Copy link
Collaborator

Both \Carsdotcom\LaravelJsonModel\JsonModel::updateRecursive and \Carsdotcom\LaravelJsonModel\JsonModel::safeUpdateRecursive correctly descend into JsonModels with JsonModel attributes, but can't transit through a CollectionOfJsonModels. If you're trying to update one property on one collection member, the entire collection member is overwritten instead.

Smart money might be to expose a common interface like SupportsUpdateRecursive that those methods detect, then implement that method on CollectionOfJsonModels. That's the approach we took with CanCascadeEvents

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

No branches or pull requests

1 participant