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

Using an EntityManagerDecorator yields a fatal error #249

Open
mcorteel-harel opened this issue Feb 6, 2020 · 1 comment · May be fixed by #260
Open

Using an EntityManagerDecorator yields a fatal error #249

mcorteel-harel opened this issue Feb 6, 2020 · 1 comment · May be fixed by #260

Comments

@mcorteel-harel
Copy link

According to Doctrine best practices, I implemented an EntityManagerDecorator. But then the jms-job-queue:run command yielded:

Return value of JMS\JobQueueBundle\Command\RunCommand::getEntityManager() must be an instance of Doctrine\ORM\EntityManager, instance of App\Service\EntityManagerDecorator returned.

My App\Service\EntityManagerDecorator extends Doctrine\ORM\Decorator\EntityManagerDecorator, according to https://github.com/doctrine/orm/blob/2.7/lib/Doctrine/ORM/EntityManager.php#L55
This is not really documented and I'm not sure if I did it correctly, but I guess JMS\JobQueueBundle\Command\RunCommand should expect Doctrine\ORM\EntityManagerInterface instead of Doctrine\ORM\EntityManager for its return value.

I'll gladly provide more details if necessary.

@mcorteel-harel mcorteel-harel changed the title Using an EntityManagerDecorator yelds a fatal error Using an EntityManagerDecorator yields a fatal error Feb 6, 2020
@cklm
Copy link
Contributor

cklm commented Feb 6, 2020

you are right, the Interface should be used to ensure that Decorators work properly - did an pull-request

@Murielle666 Murielle666 linked a pull request Mar 19, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants