For the shortcrust pastry: Put the flour, butter and a pinch of salt in a food processor and process briefly. Add half the beaten egg and continue to process. (You might add a little more egg, but not too much as the mixture should be just moist enough to come together.)
If making the pastry by hand, rub the butter into the flour until it resembles coarse breadcrumbs then, using your hands, add just enough egg to bring it together.
With your hands, flatten out the ball of dough until it is about 2cm thick, then wrap it in cling film and leave in the fridge for at least 30 minutes before using.
Preheat the oven to 180 ̊C. Line a muffin tray with the shortcrust pastry and cover the base with baking paper. Fill with baking beans and bake blind for 10-15 minutes. Remove the beans and parchment for the last five minutes of baking for a golden crust.
For the filling: Heat the oil in a frying pan and cook the bacon for 5-6 minutes, or until crisp. Remove and drain on kitchen paper. Sweat the onions gently in the same oil for a further 10 minutes, or until softened.
Meanwhile, whisk the two whole eggs and two egg yolks in a medium-sized bowl, add the cream, herbs, cheeses and bacon and onions. Mix well and season with salt and black pepper.
Pour the filling into the pastry base and return to the oven to bake for 30- 40 minutes, or until the centre has set.