Replaced depreciated getEntityManager with getManager