[PHPCR-80] ChildrenCollection is not updated after flush although children where added before Created: 07/Sep/12  Updated: 15/Feb/14  Resolved: 15/Feb/14

Status: Closed
Project: Doctrine PHPCR
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Uwe Jäger Assignee: Lukas Kahwe
Resolution: Cannot Reproduce Votes: 0
Labels: None


 Description   

If you create children of a document without adding them to the children collection of the parent (with a children annotation) the children collection is not updated after flush, you need to call $dm->clear() to force a reread of the children. The current case was with a parent and its children created in the same flush.



 Comments   
Comment by Uwe Jäger [ 07/Sep/12 ]

Try this code:

$node1 = new Generic();
$node1->setParent($parent);
$node1->setNodename('source');
$this->dm->persist($node1);

$this->childrenNames = array('first', 'second', 'third', 'fourth');
foreach ($this->childrenNames as $childName)

{ $child = new Generic(); $child->setNodename($childName); $child->setParent($node1); $this->dm->persist($child); }

$this->dm->flush();
$this->dm->clear();

$node = $this->dm->find(null, '/functional/source');
$children = $node->getChildren();

// without the clear above $children === NULL, with the clear it works as expected

Comment by David Buchmann [ 14/Jan/13 ]

lukas, is this fixed with the work you did on cascading?

Comment by David Buchmann [ 12/Mar/13 ]

we did a lot of refactoring on cascading lately. uwe, can you check if the problem still exists and do a pull request with a failing test if it exists?

Comment by David Buchmann [ 05/Dec/13 ]

uwe, is this issue still relevant?

Generated at Thu Sep 18 11:58:19 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.