Google\Cloud\Datastore\Key::pathEndIdentifier PHP Method

pathEndIdentifier() public method

If the key is incomplete, returns null. Example: $lastPathElementIndentifier = $key->pathEndIdentifier();
public pathEndIdentifier ( ) : string | integer | null
return string | integer | null
    public function pathEndIdentifier()
    {
        $end = $this->pathEnd();
        if (isset($end['id'])) {
            return $end['id'];
        }
        if (isset($end['name'])) {
            return $end['name'];
        }
        return null;
    }

Usage Example

コード例 #1
0
 public function testPathEndIdentifierNull()
 {
     $key = new Key('foo', ['path' => [['kind' => 'foo', 'id' => 2], ['kind' => 'bar']]]);
     $this->assertNull($key->pathEndIdentifier());
 }