Replaced deprecated getEntityManager with getManager