Method | Description | |
---|---|---|
__construct ( string $projectId, array $options = [] ) | Create a Key. | |
__toString ( ) | Represent the path as a string. | |
ancestor ( string $kind, string | integer $identifier, array $options = [] ) : |
Add a path element to the beginning of the Key path. | |
ancestorKey ( |
Use another Key's path as the current Key's ancestor | |
jsonSerialize ( ) | ||
keyObject ( ) : array | Get the key object formatted for the datastore service. | |
path ( ) : array | Get the key path | |
pathElement ( string $kind, string | integer $identifier = null, array $options = [] ) : |
Add a path element to the end of the Key path | |
pathEnd ( ) : array | Get the last pathElement in the key | |
pathEndIdentifier ( ) : string | integer | null | Get the last pathElement identifier. | |
pathEndIdentifierType ( ) : string | null | Get the last pathElement identifier type. | |
setLastElementIdentifier ( string $value, string $type = Key::TYPE_ID ) : void | Set the value of the last path element in a Key | |
state ( ) : boolean | Check if the Key is considered Named or Incomplete. |
Method | Description | |
---|---|---|
determineIdentifierType ( mixed $identifier, string | null $identifierType ) : string | Determine whether the given identifier is an ID or a Name | |
normalizeElement ( string $kind, mixed $identifier, string $identifierType ) : array | Determine the identifier type and return the valid pathElement | |
normalizePath ( array $path ) : array | Normalize the internal representation of a path |
public __construct ( string $projectId, array $options = [] ) | ||
$projectId | string | The project ID. |
$options | array | [optional] { Configuration Options @type string $namespaceId Partitions data under a namespace. Useful for [Multitenant Projects](https://cloud.google.com/datastore/docs/concepts/multitenancy). Applications with no need for multitenancy should not set this value. @type array $path The initial Key path. } |
public ancestor ( string $kind, string | integer $identifier, array $options = [] ) : |
||
$kind | string | The kind. |
$identifier | string | integer | The name or ID of the object. |
$options | array | { Configuration Options @type string $identifierType [optional] If omitted, the type will be determined internally. Setting this to either `Key::TYPE_ID` or `Key::TYPE_NAME` will force the pathElement identifier type. } |
return |
public ancestorKey ( |
||
$key | The ancestor Key. | |
return |
public pathElement ( string $kind, string | integer $identifier = null, array $options = [] ) : |
||
$kind | string | The kind. |
$identifier | string | integer | [optional] The name or ID of the object. |
$options | array | { Configuration Options @type string $identifierType [optional] If omitted, the type will be determined internally. Setting this to either `Key::TYPE_ID` or `Key::TYPE_NAME` will force the pathElement identifier type. } |
return |
public pathEndIdentifierType ( ) : string | null | ||
return | string | null |