If you have the time, sprinkle the aubergines with salt and leave to drain in a colander for 30 minutes. Rinse and pat dry with kitchen paper.
Fry the onion in the oil until soft. Add more oil and the aubergines and fry, stirring, until soft and lightly coloured. Add a little more oil if necessary and the garlic and fry, stirring, until the aroma rises. Remove the pan from the heat and mix with the rest of the ingredients in a bowl.
Oil a shallow ovenproof dish and pour in the aubergine mixture.