refactor get_viewip_data method to Doctrine