Details
-
Type:
New Feature
-
Status:
Reopened
-
Priority:
Trivial
-
Resolution: Unresolved
-
Affects Version/s: 2.0-BETA2
-
Fix Version/s: None
-
Component/s: ORM
-
Security Level: All
-
Labels:None
Description
I am getting an error: 'Notice: Undefined index: sysname in ./libraries/Doctrine/ORM/Persisters/BasicEntityPersister.php on line 434' when I try to flush a change to a property that references a unique field on another object.
From poking around in the _prepareUpdateData function, it seems that it only allows you to use identifier fields:
$newValId = $uow->getEntityIdentifier($newVal); .. $result[$owningTable][$sourceColumn] = $newValId[$targetClass->fieldNames[$targetColumn]];
I'll see if I can get a test case for this set up.
Hi. That is right. Foreign keys (join columns) must point to primary keys, not arbitrary other columns, whether they're unique or not, Doctrine does not know.
In other words, joinColumn must always refer to an identifier/pk. I'm not sure but I think anything else would be a pretty strange relational model, too, but there may be usecases we have not yet encountered.
I'm afraid this will not be possible and would be very hard to implement. Of course if somebody has a patch we happily accept it (after reviewing).
Leaving this open in the case somebody wants to work on it.