Skip to content

Loading…

DDC-930: A table cannot have more than one many to many relationship with the same table when using reverse engineer #5459

Open
doctrinebot opened this Issue · 0 comments

1 participant

@doctrinebot

Jira issue originally created by user teuzz:

This is caused by taking the join column name as the identifier while generating a property name for annotation. The mapping driver detects that the same property is already defined and ends the convert process. A little bit smarter approach for me was to take the local table name. But this assumes a specific style of join table naming convention.

Doctrine\ORM\Mapping\Driver\DatabaseDriver::loadMetadataForClass()

Replace:

$associationMapping['fieldName'] = Inflector::camelize(strreplace('id', '', strtolower(current($otherFk->getColumns()))));

With:

$name = explode("",$myFk->getLocalTableName());
if (count($name) > 1)
{
array_shift($name);
}
$name = implode("
", $name);

                $associationMapping['fieldName'] = Inflector::camelize(str*replace('*id', '', strtolower($name)));

Maybe to switch to this behavior with an additional option?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.