Use $this->getDoctrine()->getManager() instead. 
Your code will breaks the library if the manager of users is not the default one.