Preheat the oven to 200 C. In a baking dish, combine the tomatoes, olive oil, garlic, shallots, basil, chilli flakes, salt, and pepper. Roast in the oven for 10 minutes.
Add the orzo and pesto. Pour over 2 1/2 cups of water and stir to combine. Return the dish to the oven and bake for 12-15 minutes, until most of the water has cooked into the pasta, but not all of it.
Stir the pasta around, then sprinkle over the cheese. Bake another 10 minutes, until the cheese has melted and the sauce bubbling. If there's a lot of oil from the pesto on top, drain off the excess. Top with fresh basil!