createDBRef() public method

Creates a database reference
public createDBRef ( string $collection, mixed $document_or_id ) : array
$collection string The collection to which the database reference will point.
$document_or_id mixed
return array Returns a database reference array.
コード例 #1
0
ファイル: LoggableMongoDB.php プロジェクト: mongator/mongator
 /**
  * createDbRef.
  */
 public function createDBRef($collection, $a)
 {
     $this->time->start();
     $return = parent::createDBRef($collection, $a);
     $time = $this->time->stop();
     $this->log(array('type' => 'createDBRef', 'collection' => $collection, 'a' => $a, 'time' => $time));
     return $return;
 }
コード例 #2
0
    public function testIsRef() {
        $this->assertFalse(MongoDBRef::isRef(array()));
        $this->assertFalse(MongoDBRef::isRef(array('$ns' => 'foo', '$id' => 'bar')));
        $ref = $this->object->createDBRef('foo.bar', array('foo' => 'bar'));
        $this->assertEquals(NULL, $ref);

        $ref = array('$ref' => 'blog.posts', '$id' => new MongoId('cb37544b9dc71e4ac3116c00'));
        $this->assertTrue(MongoDBRef::isRef($ref));
    }
コード例 #3
0
ファイル: Database.php プロジェクト: alcaeus/mongodb
 /**
  * Wrapper method for MongoDB::createDBRef().
  *
  * @see http://php.net/manual/en/mongodb.createdbref.php
  * @param string $collection
  * @param mixed  $a
  * @return array
  */
 public function createDBRef($collection, $a)
 {
     return $this->mongoDB->createDBRef($collection, $a);
 }