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

pathEndIdentifierType() public method

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

Usage Example

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