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

Resolve methodcall args in QueryBuilderType with proper Scope #513

Open
wants to merge 2 commits into
base: 1.4.x
Choose a base branch
from

Conversation

janedbal
Copy link
Contributor

@janedbal janedbal commented Jan 9, 2024

Resolves #512

@@ -48,7 +48,8 @@ public function getTypeFromMethodCall(
}

return new $class(
$this->queryBuilderClass ?? 'Doctrine\ORM\QueryBuilder'
$this->queryBuilderClass ?? 'Doctrine\ORM\QueryBuilder',
$scope
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To pass Scope in a type is weird. Perhaps we should do argumentsProcessor->processArgs sooner and carry the final args in the Type? Or something different like that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was my original thought, but this felt easier. Anyway, do you see any real issue with this approach?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw to fix the failing tests, I probably need to store Scope per the method call inside.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this is still going to be wrong in some cases, as the failing tests prove. One Scope per QueryBuilder is not enough as the scope changes when the QB gets built. Better process the args sooner.

@janedbal janedbal changed the base branch from 1.4.x to 1.3.x January 9, 2024 13:49
@janedbal janedbal changed the base branch from 1.3.x to 1.4.x January 9, 2024 13:50
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

Successfully merging this pull request may close these issues.

self::class in entity is interpreted in wrong context
3 participants