Use ObjectManager interface instead of EntityManager
Use ObjectManager interface instead of EntityManager

If you use the EntityManager Decorator pattern that doctrine provides
then simply specifying a query_builder closure where your decorated
em is used fails as it isn't an instance of Doctrine\ORM\EntityManager.
Testing against the ObjectManager interface fixes the issue.

symfony/doctrine-bridge,symfony/DoctrineBridge