Fix deprecated warning in symfony 2.2

The method getEntityManager throws a deprecated warning since Symfony 2.2.