Heat the oil in a large saucepan, add the onion and cook for 1-2 minutes. Add the pancetta and chilli flakes and cook, stirring, for a further 2-3 minutes, until crispy. Add the borlotti and cannellini beans and cook, stirring, for 1-2 minutes, then add the chopped tomatoes and parsley and season to taste. Bring to the boil, then reduce the heat and simmer gently for 10 minutes, adding a little water if necessary. Pour the water into the pan, and as soon as it begins to boil, add the pasta. Cook until the pasta is al dente, following the cooking time given on the packet, adding more water if necessary. Serve immediately.