public function testGetDBRef() { $c = $this->object->selectCollection('foo'); $c->drop(); for ($i = 0; $i < 50; $i++) { $c->insert(array('x' => rand())); } $obj = $c->findOne(); $ref = $this->object->createDBRef('foo', $obj); $obj2 = $this->object->getDBRef($ref); $this->assertNotNull($obj2); $this->assertEquals($obj['x'], $obj2['x']); }
/** * Retrieves the contents of the specified $dbRef * and assigns them into $object * * @param Morph_Object $object * @param array $dbRef * @return Morph_Object */ public function fetchByDbRef(Object $object, array $dbRef) { $data = $this->db->getDBRef($dbRef); return $this->setData($object, $data); }
/** * Fetches the document pointed to by a database reference * * @link http://www.php.net/manual/en/mongocollection.getdbref.php * @param array $ref A database reference. * @return array Returns the database document pointed to by the reference. */ public function getDBRef(array $ref) { return $this->db->getDBRef($ref); }
/** * getDBRef. */ public function getDBRef($ref) { $this->time->start(); $return = parent::getDBRef($ref); $time = $this->time->stop(); $this->log(array('type' => 'getDBRef', 'ref' => $ref, 'time' => $time)); return $return; }