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

path() public method

Example: $path = $key->path();
public path ( ) : array
return array
    public function path()
    {
        return $this->path;
    }

Usage Example

Esempio n. 1
0
 /**
  * Use another Key's path as the current Key's ancestor
  *
  * Given key path will be prepended to any path elements on the current key.
  *
  * Example:
  * ```
  * $parent = $datastore->key('Person', 'Dad');
  * $key->ancestorKey($parent);
  * ```
  *
  * @param Key $key The ancestor Key.
  * @return Key
  * @throws InvalidArgumentException
  */
 public function ancestorKey(Key $key)
 {
     if ($key->state() !== self::STATE_NAMED) {
         throw new InvalidArgumentException('Cannot use an incomplete key as an ancestor');
     }
     $path = $key->path();
     $this->path = array_merge($path, $this->path);
     return $this;
 }
All Usage Examples Of Google\Cloud\Datastore\Key::path