schmittjoh / JMSJobQueueBundle

Run and Schedule Symfony Console Commands as Background Jobs
http://jmsyst.com/bundles/JMSJobQueueBundle
334 stars 254 forks source link

Using an EntityManagerDecorator yields a fatal error #249

Open mcorteel-harel opened 4 years ago

mcorteel-harel commented 4 years ago

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.

cklm commented 4 years ago

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