#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 floriank):
While further investigating and debugging testcase 1323b2 i found out that
calling of Collection->getInsertDiff() [by running '$oRecord->save();' in
line 92] results in differences between the before/after-state of the
records' relations ['stacktrace' is: Collection->getInsertDiff() ->
UnitOfWork->saveAssociations() --> UnitOfWork->saveGraph() --->
Record->save() ]. This happens although i never change any relation but
only a 'direct' attribute of my record [$oRecord->identifier =
"MySurfaceworking"; line 91]. In my opinion the reason for the differences
is a missing snapshot in Collection->getInsertDiff().
Therefore i changed the method Record->set() which is called when running
the $oRecord->identifier = "MySurfaceworking"; on line 91. My new
Record->set()-method now takes a snapshot for all relations when
Record->_state changes from CLEAN to DIRTY and the relation has no
snapshot yet. I dont know if this is the right place for taking these
snapshots but it works for me: Testcase 1323b2 is now running...
changed code is:
{{{
[/lib/Doctrine/Record.php]
[...]
public function set($fieldName, $value, $load = true)
[...]
switch ($this->_state) {
case Doctrine_Record::STATE_CLEAN:
case Doctrine_Record::STATE_PROXY:
$this->_state = Doctrine_Record::STATE_DIRTY;
/* FIXME Ticket 1323b2 */
foreach ($this->_references as $ref) {
if (get_class($ref) == "Doctrine_Collection") {
if (count($ref->getSnapshot()) == 0)
$ref->takeSnapshot();
}
}
/* end 1323b2 */
break;
case Doctrine_Record::STATE_TCLEAN:
$this->_state = Doctrine_Record::STATE_TDIRTY;
break;
}
[...]
}
[...]
}}}
Do you have any idea if this is the right place to look for the problem?
--
Ticket URL: <http://trac.phpdoctrine.org/ticket/1323#comment:8>
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
-~----------~----~----~----~------~----~------~--~---