-
Notifications
You must be signed in to change notification settings - Fork 642
Closed
Labels
Description
I find that $relatedQuery.findById and $relatedQuery.insert will mutate the relations loaded on a model instance.
I find that this isn't particularly useful & tends to create more problems than it avoids.
Consider e.g
- Loading a model with a filtered relation. Any insert or find operation on the same relation using
$relatedQuerybreaks the filter. - A 'shortcut' relation that is defined only for syntactic sugar (e.g often this is the inverse of a more common access pattern - e.g find
genrerelated to thisartist, where you usually accessgenre->artist& don't really wantgenrenested underartistwhen serialized etc.) - querying with$relatedQueryyou now have an unwanted piece of data non-obviously nested in your model
My proposal would be to disable this behaviour as I don't think a complete solution exists here.