Fix deprecated method getEntityManager