-
Notifications
You must be signed in to change notification settings - Fork 98
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
allow EntityRepository usage by interfaces #141
Conversation
b2b2414
to
1fe21ab
Compare
@Marmelatze Could you rebase this? It would be great to have support like this merged. |
Can you please explain what's the current situation on phpstan-doctrine 1.2.6 and what kind of code pattern doesn't work and what's the error message from PHPStan? |
For example:
Will result in:
With debug:
|
This exception might already be prevented in phpstan-doctrine 1.2.6. If it still throws for you, then try phpstan-doctrine dev-master. Thanks :) |
It work with 1.2.6 but only if using the default repository methods (find, findBy). Custom repository methods are not recognized |
@Marmelatze Have you set your base repository class per https://github.com/phpstan/phpstan-doctrine#configuration ? |
Yes. Maybe my problem is somewhat special: I have some Entities that implement one interface. All these entities have a repository that share a common Interface. phpstan-doctrine will not recognize calls to I worked around this by specifying a type alias in phpstan.neon that contains all entites that implement said interface. |
Alright ✌️ |
Allows the usage of EntityRepositories by interface name.
So EntityRepositories can be passed around that implement a common interface and return entities that have a common interface.
Currently the extension throws a MappingException, as the interface can not be found by the doctrine ClassMetadataLoader