You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While upgrading to objection 3.0.1, I noticed that Model.relatedQuery still mutates the original object if you set Model.relatedFindQueryMutates = true or Model.relatedInsertQueryMutates = true. In objection 2 these were marked as deprecated and said to be removed in objection 3.
The documentation regarding the config values was removed in the upgrade but it seems that the actual code stayed the same. The deprecation messages were also removed from the code, so this makes me wonder if it was decided to keep the functionality after all or if it was just too laborious to remove it completely from the code. Our codebase relies quite heavily on this feature, so I wouldn't like to make huge changes if it's not required.
I assume that since the package is no longer actively maintained, the functionality of these configs won't probably change much in the future.
Question
Can we use Model.relatedFindQueryMutates and Model.relatedInsertQueryMutates configs to make the Model.relatedQuery to mutate the original object in objection 3?
The text was updated successfully, but these errors were encountered:
That's a good question! The intent was indeed for it to go away, but with @koskimas having moved on, we need to decide what to do about it.
Looking through the code, I can see that this is setting operation.assignResultToOwner internally. And relatedFindQueryMutates + relatedInsertQueryMutates are not the only settings that cause this behavior. operation.assignResultToOwner is also set for WhereInEagerOperation (withGraphFetched()), RelationFindOperation and RelationInsertOperation, where it hasn't been deprecated.
Removing support for relatedFindQueryMutates + relatedInsertQueryMutates would remove very little actual code, so I don't really see the benefits of doing so.
Description
While upgrading to objection 3.0.1, I noticed that
Model.relatedQuery
still mutates the original object if you setModel.relatedFindQueryMutates = true
orModel.relatedInsertQueryMutates = true
. In objection 2 these were marked as deprecated and said to be removed in objection 3.The documentation regarding the config values was removed in the upgrade but it seems that the actual code stayed the same. The deprecation messages were also removed from the code, so this makes me wonder if it was decided to keep the functionality after all or if it was just too laborious to remove it completely from the code. Our codebase relies quite heavily on this feature, so I wouldn't like to make huge changes if it's not required.
I assume that since the package is no longer actively maintained, the functionality of these configs won't probably change much in the future.
Question
Can we use
Model.relatedFindQueryMutates
andModel.relatedInsertQueryMutates
configs to make theModel.relatedQuery
to mutate the original object in objection 3?The text was updated successfully, but these errors were encountered: