-
Notifications
You must be signed in to change notification settings - Fork 111
ManagerRegistry::getRepository returns correct EntityRepository #46
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
Conversation
|
Hi, please also add some error on purpose to the example file so that it can be seen it’s the right type detected. It will generate a JSON file you also need to commit. Thanks. |
ecfb34f to
3318782
Compare
|
|
||
| public function findDynamicType(): void | ||
| { | ||
| $test = $this->managerRegistry->getRepository(MyEntity::class)->createQueryBuilder('e'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think its a bit more obvious now, createQueryBuilder is only on EntityRepository, not ObjectRepository that would normally be the type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't what I meant. I didn't want phpstan-negative.neon that doesn't have the extension. Rather, I wanted to verify that the extension works. So I'd like to have only a single integration "levels" test that verifies that ManagerRegistry::getRepository() actually returns EntityRepository, by calling something nonexistent on the EntityRepository object.
So besides verifying that "Call to an undefined method Doctrine\Common\Persistence\ObjectRepository::createQueryBuilder()." does NOT GET reported, I'd also like to know that $this->managerRegistry->getRepository(MyEntity::class)->nonexistent() GETS reported.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I think I see what you mean, so you want to prove its an entity manager because the error will say its an entity manager, and they dont have function x.
One moment :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the negative option didnt seem great, but i didnt understand what you where asking...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to see that $this->managerRegistry->getRepository(MyEntity::class) returns the right thing and not just mixed (that silents all errors).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its done now.
f1c03b2 to
20f2eb1
Compare
20f2eb1 to
2910fcc
Compare
|
Thanks, perfect! |
Similar to how ObjectManager:: getRepository works, but for ManagerRegistry