fixing deprecated call to entity manager