Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.2.0
-
Fix Version/s: None
-
Component/s: Relations
-
Labels:None
-
Environment:Mac OSX 10.5, Symfony 1.4 and MAMP
Description
There is a problem when you save Many to Many Self Referencing (Nest Relations).
I used the same example that it's used on Doctrine 1.2 Self Referencing (Nest Relations) Documentation:
My Schema:
User:
columns:
name:Unknown macro: { type}relations:
Parents:
class: User
local: child_id
foreign: parent_id
refClass: UserReference
foreignAlias: ChildrenUserReference:
columns:
parent_id:
type: integer
primary: true
child_id:
type: integer
primary: true
Fixtures:
User:
james:
name: James
alexander:
name: Alexander
david:
name: David
The problem happens with the Children. The first time I assigned children and saved the User, there is no problem; but when I saved the User again (without any change on him) the values in the UserReference? table changes: the "parent_id" takes the value of the "child_id".
I test it with Sf 1.4 and with Sf 1.3 stable versions, and I've got the same error.
If it not clear to understand what I'm saying, I put a "very ilustrative" image about the form and how change the values of the UserReference? table. Please see it, because it would be very usefull for understanding (explains better than my terrible English)
Thanks for all your work!
P. D.
I forgot to to say that watching the stack trace I think that the problem is in:
symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection/UnitOfWork.php
In the line 429:
public function saveAssociations(Doctrine_Record $record)
I would like to help more, but I couldn't figure out how this function works.