First make the pastry.
Cut the butter into small pieces, then put it into a food processor together with the flour and a good pinch of salt.
Reduce to fine crumbs, then add the egg yolk, grated parmesan and as much water as needed to make a firm but rollable dough (usually 1-3 tbsp).
Turn the dough out on to a lightly floured board and bring together into a ball.
Chill in the fridge for 20 minutes.
For the filling, peel and halve the onions and cut into thin segments.
Warm the oil in a large, deep saucepan.
Add the onions and let them cook, partially covered by a lid, for a good 25 minutes until soft and golden.
Stir them regularly.
While the onions are cooking, chop and stir in the thyme leaves.
Peel and carefully grate the garlic and stir into the onions.
When the onions are pale gold in colour, sticky and soft, stir in the sherry vinegar and a grinding of salt and black pepper.
Remove the pastry from the fridge and roll it out on a lightly floured board to fit the tart tin.
Lower it into place, usher it up the sides of the tin and trim any overhanging pastry.
Heat the oven to 200C/gas mark 6 and place an empty baking sheet in to heat up.
Loosely line the pastry with kitchen foil or baking parchment and fill with baking beans (I use old coffee beans), then bake on top of the heated baking sheet for 20 minutes.
Carefully remove the paper and baking beans and return to the oven for 5 minutes until dry to the touch.
Crumble the cheese into pieces about the size of a hazelnut.
Transfer the onions to the baked tart case and distribute the cheese among them.
Bake on top of the hot baking sheet for about 30 minutes until the surface is golden.
Leave to settle for 15 minutes, then cut into pieces with a large, sharp knife.
