Heat the rest of the oil in a small frying pan and cook the onion over a medium-low heat until soft. Add the garlic and cook for another couple of minutes. Scrape this into the gratin dish on top of the tomatoes, then spread the beans on top. Season again and then pour the cream on top. Scatter on the cheeses and the breadcrumbs and bake for 30 minutes. The top will be bubbling and golden.