public function testReferenceMany()
{
$refManyTestObj = new RefManyTestObj();
$refManyTestObj->id = '/functional/refManyTestObj';
$refManyTestObj->name = 'referrer';
$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');
$this->assertCount($max, $referrer->references);
$refnode = $this->session->getNode('/functional')->getNode('refManyTestObj');
foreach ($refnode->getProperty('myReferences')->getNode() as $referenced) {
$this->assertTrue($referenced->hasProperty('name'));
}
}