-
Notifications
You must be signed in to change notification settings - Fork 43
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
fix query stub #114
fix query stub #114
Conversation
Thanks! @dimajolkin this was a change you proposed not too long ago, do you agree with the proposed change? (I don't use doctrine a lot so I prefer reaching a consensus before merging things like this :) ) |
Hello) Sorry but your code will break my project)
For example i'm use as
|
Yeah but that's not quite the question :) The question is to be correct in what the method can return. If it can return something else than an entity, it's not correct to leave an entity in the return type |
Sorry) Meybe you try it "@template T as mixed" ? |
For example i'm use as
I would say that as long you dont use psalm level 1, it will still work. On psalm level 1, you will need to add phpdoc after the getQuery to say it's a
@orklah This PR is totally correct to me
will be a list of id, and not a list of Teacher. I can even do
And I will get a list of Pupils in the TeacherRepository. The createQueryBuilder inside a EntityRepository is not limited to a QueryBuilder at all. Then, it makes no sens to add a template param to the QueryBuilder class, since it can change as soon as I use On the contrary, Query can have a template. Because as soon as the |
I see it) Thanks) in that case everything is ok |
Thanks everyone :) |
Hi @orklah, this pr allows a query of MyEntity to return something else than Query, if I select
myEntity.label
for instance. A queryBuilder could return any type of query.That is why there is no template in phpstan: https://github.com/phpstan/phpstan-doctrine/blob/master/stubs/ORM/QueryBuilder.stub
Btw the type of the hydrationMode was wrong: https://github.com/doctrine/orm/blob/2.11.x/lib/Doctrine/ORM/AbstractQuery.php#L864.