public function testMoveParentNoNodeName() { $root = $this->dm->find(null, 'functional'); $parent1 = new ParentTestObj(); $parent1->nodename = "root1"; $parent1->name = "root1"; $parent1->setParentDocument($root); $parent2 = new ParentTestObj(); $parent2->name = "/root2"; $parent2->nodename = "root2"; $parent2->setParentDocument($root); $child = new ParentNoNodeNameTestObj(); $child->setParentDocument($parent1); $child->name = "child"; $this->dm->persist($parent1); $this->dm->persist($parent2); $this->dm->persist($child); $this->dm->flush(); $child->setParentDocument($parent2); $this->dm->persist($child); try { $this->dm->flush(); } catch (\Exception $e) { $this->fail('An exception has been raised moving a child node from parent1 to parent2.'); } }
public function benchPersistMany() { $parent1 = new ParentTestObj(); $parent1->nodename = "root1"; $parent1->name = "root1"; $parent1->setParentDocument($this->root); $parent2 = new ParentTestObj(); $parent2->name = "/root2"; $parent2->nodename = "root2"; $parent2->setParentDocument($this->root); $child = new ParentNoNodeNameTestObj(); $child->setParentDocument($parent1); $child->name = "child"; $c1 = new Comment(); $c1->name = 'c1'; $c1->parent = $this->root; $c1->setText('deutsch'); $group1 = new \Doctrine\Tests\Models\CMS\CmsGroup(); $group1->name = "Test!"; $group1->id = '/functional/group1'; $group2 = new \Doctrine\Tests\Models\CMS\CmsGroup(); $group2->name = "Test!"; $group2->id = '/functional/group2'; $user = new \Doctrine\Tests\Models\CMS\CmsUser(); $user->username = "******"; $user->name = "Benjamin"; $user->addGroup($group1); $user->addGroup($group2); $this->documentManager->persist($parent1); $this->documentManager->persist($parent2); $this->documentManager->persist($child); $this->documentManager->persist($c1); $this->documentManager->persist($user); $this->documentManager->persist($group1); $this->documentManager->persist($group2); $this->documentManager->flush(); }