An entity that has two many to many fields that referrence the same entity can't exist on its own, because ClassMetadataInfo uses the actual name of the referrenced entity to define joining table.
When there are for example Product and TextFile entities and you want to assigng the TextFile entitites to the Product entity firstly as descriptions (that are for example displayed on a product page) and secondly as simple text files (that can be downloaded on the product page, but are not displayed), ClassMetadataInfo tries to generate joining table called product_textfile for the descriptions field, then tries to generated joining table called product_textfile for the textfiles, but the latter will fail, because the product_textfile table already exists.
I propose that the table name generation strategy for many to many relations is changed so it will use the actual field name rather than the entity name. In the above example the joining tables would be product_descriptions and product_textFiles. I know that the standard naming conventions for database tables are not to use plurals, but I think it's better to use plurals and have those joining tables created automatically than not use them and have the user set names for the joining tables manually.
This new behaviour can be achieved by changing the file ClassMetadataInfo.php, line 837 from $targetShortName = substr($mapping['targetEntity'], strrpos($mapping['targetEntity'], '
') + 1); to $targetShortName = $mapping['fieldName'];