[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


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.

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

Try this code:

$node1 = new Generic();

$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); }


$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 Mon Nov 30 10:14:12 EST 2015 using JIRA 6.4.10#64025-sha1:5b8b74079161cd76a20ab66dda52747ee6701bd6.