Jira issue originally created by user bakura:
I use the resolve target entity listener quite often for generic code. However I found an issue with ManyToMany relationships, when the target entity is modified by the listener.
The problem is that the _validateAndCompleteManyToManyMapping in PersistentCollection duplicate the joinTableColumns, so this means that when creating an entity, Doctrine send twice the number of parameters, which of course fail.
Here is a test that reproduce the problem.
public function testAssertTableColumnsAreNotAddedInManyToMany()
$evm = $this->em->getEventManager();
$cm = $this->factory->getMetadataFor('Doctrine\Tests\ORM\Tools\ResolveTargetEntity');
$meta = $cm->associationMappings['manyToMany'];
$this->assertEquals(array('resolvetargetentity*id', 'targetinterface*id'), $meta['joinTableColumns']);
Issue was closed with resolution "Fixed"