public function testGetDBRef() { for ($i = 0; $i < 50; $i++) { $this->object->insert((object) array('x' => rand())); } $obj = $this->object->findOne(); $ref = $this->object->createDBRef($obj); $obj2 = $this->object->getDBRef($ref); $this->assertNotNull($obj2); $this->assertEquals($obj['x'], $obj2['x']); }
public function testGetDBRef() { $c = $this->object->selectCollection('foo'); $c->drop(); for ($i = 0; $i < 50; $i++) { $c->insert((object) array('x' => rand()), array("safe" => true)); } $obj = $c->findOne(); $ref = $this->object->createDBRef('foo', $obj); $obj2 = $this->object->getDBRef($ref); $this->assertNotNull($obj2); $this->assertEquals($obj['x'], $obj2['x']); }
/** * Get ref * * @param array $ref ref * * @return \MongoDBRef */ public function getRef(array $ref) { return $this->_connection->getDBRef($ref); }