Make the dough in the food processor by mixing the flour, salt and butter to form crumbs. Add the ricotta and water and pulse until comes together. Remove blade and bring the pastry together in a ball. Cover and chill until needed (you can make it a little ahead)
Slice the onions into quarter rings and slice the mushrooms, cutting larger slices in half.
Put 1tbsp butter and the oil in a medium skillet/frying pan over a medium heat. Add the onions and cook around 5 minutes until softened and just starting to caramelize.
Add the mushrooms, garlic and thyme along with the rest of the butter. Soften and cook until the liquid has largely evaporated, stirring regularly. Set aside.
Preheat oven to 400F/200C.
Roll out the pastry on a lightly floured surface in a circle approx ⅛in/3mm thick (it doesn't have to be perfect). Transfer to a lined baking sheet/tray.
Spread a thin layer of ricotta on the pastry leaving around 1 ¼in/4cm around the edge.
Add the mushrooms on top, spreading out evenly leaving the same edge without topping, then top with slices of fontina.
Fold in the edges, making pleats as you go, then brush with eggwash.
Sprinkle a little parmesan over top, including pastry, then bake until golden, around 20-25 minutes. Best served warm.