Doctrine\Tests\ODM\PHPCR\Functional\ReferenceTest::testUpdateMany PHP Метод

testUpdateMany() публичный Метод

public testUpdateMany ( )
    public function testUpdateMany()
    {
        $refManyTestObj = new RefManyTestObj();
        $refManyTestObj->id = "/functional/refManyTestObj";
        $max = 5;
        for ($i = 0; $i < $max; $i++) {
            $newRefRefTestObj = new RefRefTestObj();
            $newRefRefTestObj->id = "/functional/refRefTestObj{$i}";
            $newRefRefTestObj->name = "refRefTestObj{$i}";
            $refManyTestObj->references[] = $newRefRefTestObj;
        }
        $this->dm->persist($refManyTestObj);
        $this->dm->flush();
        $this->dm->clear();
        $referrer = $this->dm->find($this->referrerManyType, '/functional/refManyTestObj');
        $i = 0;
        foreach ($referrer->references as $reference) {
            $reference->name = "new name " . $i;
            $i++;
        }
        $this->dm->persist($referrer);
        $this->dm->flush();
        $this->dm->clear();
        $this->dm->find($this->referrerManyType, '/functional/refManyTestObj');
        $i = 0;
        foreach ($this->session->getNode('/functional/refManyTestObj')->getProperty('myReferences')->getNode() as $node) {
            $this->assertEquals($node->getProperty('name')->getValue(), "new name " . $i);
            $i++;
        }
        $this->assertEquals($i, $max);
    }