Details
-
Type:
Improvement
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 2.0-RC2
-
Fix Version/s: None
-
Component/s: Mapping Drivers
-
Security Level: All
-
Labels:None
-
Environment:FreeBSD, PostgreSQL 8.4
Description
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(str_replace('_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?