A flight to Edinburgh Airport declared a mid-air emergency as it began preparations to land.