The source code of Doctrine ORM claims that EntityManager::getReference() (and EntityManager::getPartialReference()) sometimes returns null. And there is indeed such case in the implementation as well. But I don't understand the circumstances when it actually happens and it never occurred in my projects. Can you explain how is this possible and how to reproduce such case?