MDL-64057 core_favourites: add get_join_sql_by_type() to service layer