Heat the oil in a pan and fry the diced onion until translucent. Cut the mushrooms and ham into slices, place in the pan and fry for 3-4 minutes on the highest level. Then add the cream cheese, set the stove to medium heat and stir until the cheese has dissolved. Then stir in the cream, season and carefully pull the spaetzle into the sauce. Put the lid on the pan and let the dish simmer on the lowest setting for 5-10 minutes, stirring occasionally.