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

Model.relatedFindQueryMutates and Model.relatedInsertQueryMutates weren't removed in objection 3 #2356

Open
mikitane opened this issue Jan 27, 2023 · 1 comment

Comments

@mikitane
Copy link

mikitane commented Jan 27, 2023

Description

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?

@lehni
Copy link
Collaborator

lehni commented Apr 14, 2023

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.

@kibertoad what's your opinion no this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants