setLastElementIdentifier() public method

This method is used internally when IDs are allocated to existing instances of a Key. It should not generally be used externally. Example: $key = $datastore->key('Person'); $key->setLastElementIdentifier('Bob', Key::TYPE_NAME);
public setLastElementIdentifier ( string $value, string $type = Key::TYPE_ID ) : void
$value string The value of the ID or Name.
$type string [optional] 'id' or 'name'. **Defaults to** `"id"`.
return void
コード例 #1
0
ファイル: KeyTest.php プロジェクト: Radiergummi/anacronism
 public function testSetLastElementIdentifierTypeName()
 {
     $key = new Key('foo', ['path' => [['kind' => 'foo', 'id' => 2], ['kind' => 'foo']]]);
     $key->setLastElementIdentifier(1, Key::TYPE_NAME);
     $this->assertEquals($key->path(), [['kind' => 'foo', 'id' => 2], ['kind' => 'foo', 'name' => 1]]);
 }