PhpOrient\Protocols\Binary\Data\Record::getRid PHP Method

getRid() public method

Gets the Record ID
public getRid ( ) : PhpOrient\Protocols\Binary\Data\ID
return PhpOrient\Protocols\Binary\Data\ID
    public function getRid()
    {
        if (!$this->rid instanceof ID) {
            $this->rid = new ID();
        }
        return $this->rid;
    }

Usage Example

 public function testReLoadUpdate()
 {
     if ($this->client->getTransport()->getProtocolVersion() < 26) {
         //            $this->markTestSkipped( 'Record Create/Update Unpredictable Behaviour' );
     }
     $recOrig = ['alloggio' => 'case', 'lavoro' => 'mercato', 'vacanza' => 'mare'];
     $rec = new Record();
     $rec->setOData($recOrig);
     $result = $this->client->execute('recordCreate', ['cluster_id' => 9, 'record' => $rec]);
     $this->assertInstanceOf('\\PhpOrient\\Protocols\\Binary\\Data\\Record', $result);
     $this->assertEquals('#9:0', (string) $result->getRid());
     $this->assertEquals('9', $result->getRid()->cluster);
     $this->assertEquals('0', $result->getRid()->position);
     $recUp = ['alloggio' => 'home', 'lavoro' => 'bazar', 'vacanza' => 'sea'];
     //push the old record with a new value
     $rec->setOData($recUp);
     $rec->setOClass('V');
     $updated = $this->client->execute('recordUpdate', ['rid' => $rec->getRid(), 'record' => $rec]);
     $this->assertInstanceOf('\\PhpOrient\\Protocols\\Binary\\Data\\Record', $result);
     $this->assertEquals('#9:0', (string) $updated->getRid());
     $this->assertEquals('9', $updated->getRid()->cluster);
     $this->assertEquals('0', $updated->getRid()->position);
     $this->assertTrue($updated->getVersion() > 0);
     //assert that the created record is the same as the updated
     // ( why not should be?? is the same object this time )
     $this->assertEquals((string) $rec, (string) $updated);
     $load = $this->client->execute('recordLoad', ['rid' => $updated->getRid()]);
     $this->assertInstanceOf('\\PhpOrient\\Protocols\\Binary\\Data\\Record', $load[0]);
     $this->assertEquals((string) $updated->getRid(), (string) $load[0]->getRid());
     $this->assertEquals((string) $updated, (string) $load[0]);
 }
All Usage Examples Of PhpOrient\Protocols\Binary\Data\Record::getRid