-
Notifications
You must be signed in to change notification settings - Fork 99
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
Repository type does not match with ManagerRegistry #23
Comments
Hi, is there any point using Doctrine\Common interfaces instead of
Doctrine\ORM? I’ve never seen it in the wild.
Feel free to send a PR, should be similar to currently existing extensions.
On Wed, 24 Jan 2018 at 22:24, Sullivan SENECHAL ***@***.***> wrote:
This PHP code part is valid:
$user = $this->getDoctrine()->getRepository(User::class)->find( $this->request->query->get('id'));
$this->getDoctrine() return a ManagerRegistry instance.
But the final $user does not seems to be typed:
Call to an undefined method object::getUsername().
Using the EntityManagerInterface directly make things working.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#23>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/AAGZuGYyzMS2xV0Otx5a2RBHhHGhvn3hks5tN5-pgaJpZM4Rr892>
.
--
Ondřej Mirtes
|
@ondrejmirtes Using the interfaces decouples your code from the ORM a bit and you could add a custom implementation using the interface as an extension point. The interfaces are also the only common thing between the ORM and the ODM so if you want to switch a piece of logic to be persisted in MongoDB, you wouldn't want your code to be dependent on using the ORM. |
There is also bunch of methods that you simply can't use with just ObjectRepository. Unfortunately there is no interface in ORM 2.x, but see https://github.com/doctrine/doctrine2/pull/6871/files#diff-8a10ca9860c185f1c82078d9bbaa27d5R1. |
This now works on master. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This PHP code part is valid:
$this->getDoctrine()
return aManagerRegistry
instance.But the final
$user
does not seems to be typed:Using the
EntityManagerInterface
directly make things working.The text was updated successfully, but these errors were encountered: