setLastElementIdentifier() 공개 메소드

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"`.
리턴 void
예제 #1
0
 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]]);
 }