To make the pastry: sift the flour and salt into a large bowl. Add the butter and rub in loosely (you need to see bits of butter).
Make a well in the bowl and pour in the water, mixing until you have a firm rough dough (add extra water if needed).
Cover with cling film and refrigerate for 20 mins.
Put the pastry onto a lightly floured board, knead gently and form into a smooth rectangle. Roll the dough in one direction only, until 3 times the width, about 20 x 50cm. Keep edges straight and even. Don’t overwork the butter streaks – you should have a marbled effect. Fold the top third down to the centre, then the bottom third up and over that. Give the dough a quarter turn (to the left or right) and roll out again to three times the length.
Fold as before, cover with cling film and chill for at least 20 mins before rolling to use.
When the pastry is chilled, roll it into a square just over 1cm thick and cut it into 4 equal-sized pieces, then roll these out until 3mm thick – they should be about 18cm to 20cm diameter. Stack the pastry squares with squares of non-stick parchment in between, cover and refrigerate.
Make the filling: warm the oil in a large frying pan, add the onions and a pinch of salt. Cook over a medium heat for a few minutes, until the onions start to colour. Lower the heat and stir in the garlic, bay leaf and thyme. Cook until the onions are generally golden and tender, but not mushy – about 15 minutes in total. If they dry out, lower the heat and cover the pan. Cool the onions completely, remove the thyme and strip the leaves into the onions. Discard the bay leaf.
Cut the apple into 1mm slices. Cut the bacon into 1cm strips, place in a small frying pan over a low heat for 2 minutes until the fat starts to melt into the pan. Drain off the fat, remove from the heat and toss the apple slices with the bacon.
Heat oven to 205 ̊C (185 ̊C fan).
Remove the pastry squares from the fridge and lightly score a 2cm border around the edge.
Place the squares (on their parchment) onto 2 baking sheets. Divide the onion mixture over the pastry, staying within the border.
Press in the warm apples and bacon, ensuring they lay flat (or they will burn).
Lay over the slices of Comté, fold up the pastry edges.
Bake for about 20 to 25 minutes until the pastry is rich, golden brown.