#1323: broken non-equal nest relations (many-to-many self referencing)
-----------------------+----------------------------------------------------
Reporter: floriank | Owner: romanb
Type: defect | Status: new
Priority: critical | Milestone: 1.0.0-RC2
Component: Record | Version: 0.11
Resolution: | Keywords:
Has_test: 1 | Mystatus: Pending Core Response
Has_patch: 0 |
-----------------------+----------------------------------------------------
Comment (by romanb):
Thanks for your help. You gave me a good hint, takeSnapshot() is the right
idea but in the wrong place. Snapshots of collections are there in order
to be able to determine the changes that happened to the collection since
it was fetched/created. Your patch basically suppresses all change
detection in collections because you take a fresh snapshot after each
modification.
What i did is to take a snapshot after the collection has been saved,
seems this was not done previously in UnitOfWork. That means the
association collection gets saved but no new snapshot taken, hence
Doctrine still thinks it needs to insert them on the next save. This
really becomes visible when you remove the single "id" primary key from
BaseConceptRelation and use a composite key instead (concept_id,
parent_concept_id). I would recommend to do this. Then you get an error
about a PK violation because Doctrine tries to insert the same id pair in
the association table twice (because it does not take a snapshot after
saving).
So do the following:
1) remove the id PK from BaseConceptRelation, make a composite key out of
the foreign keys (primary => true on both columns)
2) run your testcase again, you should get a primary key violation
3) Apply the following patch: http://pastie.org/261078 and run your
testcase again. It should work fine.
If this works well for you i will consider getting the whole patch into
1.0 HEAD.
--
Ticket URL: <http://trac.doctrine-project.org/ticket/1323#comment:9>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"doctrine-svn" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.co.uk/group/doctrine-svn?hl=en-GB
-~----------~----~----~----~------~----~------~--~---