Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 1.0.0BETA1
-
Component/s: None
-
Labels:None
Description
Newly added embedded relations do not get persisted when a flush() is executed before they are added to the parent document. Here is a failing test, note the comment "// Adding this flush here makes level1 not to be inserted.":
public function testFlushEmbedded()
{ $test = new EmbeddedTestLevel0(); $test->name = 'test'; $this->dm->persist($test); $this->dm->flush(); $this->dm->clear(); $test = $this->dm->findOne('Documents\Functional\EmbeddedTestLevel0'); $this->assertInstanceOf('Documents\Functional\EmbeddedTestLevel0', $test); // Adding this flush here makes level1 not to be inserted. $this->dm->flush(); $level1 = new EmbeddedTestLevel1(); $level1->name = 'test level1 #1'; $test->level1[] = $level1; $this->dm->persist($test); $this->dm->flush(); $this->dm->clear(); $test = $this->dm->findOne('Documents\Functional\EmbeddedTestLevel0'); $this->assertInstanceOf('Documents\Functional\EmbeddedTestLevel0', $test); $this->assertInstanceOf('Documents\Functional\EmbeddedTestLevel1', $test->level1[0]); }
I also experience this issue. Formatted text from original message for convenience: