No Entity Manager defined exception

This PR is linked to this issue : https://github.com/symfony/symfony/issues/9534