To make the pastry, tip the flour and butter into a bowl. Mix until mixture resembled breadcrumbs. Add in egg and knead briefly until a soft dough forms.
Roll out pastry onto a lightly floured surface. Use your rolling pin to lift it up, then drape over the tart case. Push the pastry into the corners of the tin and remove excess pastry. Prick base with a fork and chill in the fridge for 20 mins. (Make mini tarts using extra pastry)
Bake pastry at 180C for 20-25 mins until lightly golden.
For the filling, heat 2 tbsp butter in a pan and cook onions for 20-25 mins, stirring occasionally, until they become sticky and golden. Remove from the heat.
In a large bowl, mix together the onions with the remaining filling ingredients.
Carefully tip the filling into the pastry case and bake for 20-25 mins until set and golden.
Leave to cool in case before serving.