use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Firestore\V1\Client\FirestoreClient;
use Google\Cloud\Firestore\V1\Cursor;
use Google\Cloud\Firestore\V1\PartitionQueryRequest;
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function partition_query_sample(): void
{
// Create a client.
$firestoreClient = new FirestoreClient();
// Prepare the request message.
$request = new PartitionQueryRequest();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $firestoreClient->partitionQuery($request);
/** @var Cursor $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
static::anyPathName
Formats a string containing the fully-qualified path to represent
a any_path resource.
Parameters
Name
Description
project
string
database
string
document
string
anyPath
string
Returns
Type
Description
string
The formatted any_path resource.
static::databaseRootName
Formats a string containing the fully-qualified path to represent
a database_root resource.
Parameters
Name
Description
project
string
database
string
Returns
Type
Description
string
The formatted database_root resource.
static::documentPathName
Formats a string containing the fully-qualified path to represent
a document_path resource.
Parameters
Name
Description
project
string
database
string
documentPath
string
Returns
Type
Description
string
The formatted document_path resource.
static::documentRootName
Formats a string containing the fully-qualified path to represent
a document_root resource.
Parameters
Name
Description
project
string
database
string
Returns
Type
Description
string
The formatted document_root resource.
static::parseName
Parses a formatted name string and returns an associative array of the components in the name.
The following name formats are supported:
Template: Pattern
The optional $template argument can be supplied to specify a particular pattern, and must
match one of the templates listed above. If no $template argument is provided, or if the
$template argument does not match one of the templates listed, then parseName will check
each of the supported templates, and return the first match.
Parameters
Name
Description
formattedName
string
The formatted name string
template
string
Optional name of template to match
Returns
Type
Description
array
An associative array from name component IDs to component values.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Cloud Firestore V1 Client - Class FirestoreClient (1.53.0)\n\nVersion latestkeyboard_arrow_down\n\n- [1.53.0 (latest)](/php/docs/reference/cloud-firestore/latest/V1.FirestoreClient)\n- [1.52.0](/php/docs/reference/cloud-firestore/1.52.0/V1.FirestoreClient)\n- [1.51.0](/php/docs/reference/cloud-firestore/1.51.0/V1.FirestoreClient)\n- [1.50.0](/php/docs/reference/cloud-firestore/1.50.0/V1.FirestoreClient)\n- [1.48.1](/php/docs/reference/cloud-firestore/1.48.1/V1.FirestoreClient)\n- [1.47.3](/php/docs/reference/cloud-firestore/1.47.3/V1.FirestoreClient)\n- [1.46.0](/php/docs/reference/cloud-firestore/1.46.0/V1.FirestoreClient)\n- [1.45.2](/php/docs/reference/cloud-firestore/1.45.2/V1.FirestoreClient)\n- [1.44.1](/php/docs/reference/cloud-firestore/1.44.1/V1.FirestoreClient)\n- [1.43.3](/php/docs/reference/cloud-firestore/1.43.3/V1.FirestoreClient)\n- [1.40.0](/php/docs/reference/cloud-firestore/1.40.0/V1.FirestoreClient)\n- [1.39.0](/php/docs/reference/cloud-firestore/1.39.0/V1.FirestoreClient)\n- [1.38.0](/php/docs/reference/cloud-firestore/1.38.0/V1.FirestoreClient)\n- [1.37.7](/php/docs/reference/cloud-firestore/1.37.7/V1.FirestoreClient)\n- [1.36.1](/php/docs/reference/cloud-firestore/1.36.1/V1.FirestoreClient)\n- [1.35.0](/php/docs/reference/cloud-firestore/1.35.0/V1.FirestoreClient)\n- [1.34.0](/php/docs/reference/cloud-firestore/1.34.0/V1.FirestoreClient)\n- [1.33.0](/php/docs/reference/cloud-firestore/1.33.0/V1.FirestoreClient)\n- [1.32.0](/php/docs/reference/cloud-firestore/1.32.0/V1.FirestoreClient)\n- [1.31.0](/php/docs/reference/cloud-firestore/1.31.0/V1.FirestoreClient)\n- [1.30.0](/php/docs/reference/cloud-firestore/1.30.0/V1.FirestoreClient)\n- [1.28.0](/php/docs/reference/cloud-firestore/1.28.0/V1.FirestoreClient)\n- [1.27.3](/php/docs/reference/cloud-firestore/1.27.3/V1.FirestoreClient) \nReference documentation and code samples for the Cloud Firestore V1 Client class FirestoreClient.\n\nService Description: The Cloud Firestore service.\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ Firestore \\\\ V1\n\nMethods\n-------\n\n### partitionQuery\n\nSee also:\n\n- \\\\Google\\\\Cloud\\\\Firestore\\\\V1\\\\FirestoreClient::partitionQueryPaginated\n\n**Example** \n\n use Google\\ApiCore\\ApiException;\n use Google\\ApiCore\\PagedListResponse;\n use Google\\Cloud\\Firestore\\V1\\Client\\FirestoreClient;\n use Google\\Cloud\\Firestore\\V1\\Cursor;\n use Google\\Cloud\\Firestore\\V1\\PartitionQueryRequest;\n\n /**\n * This sample has been automatically generated and should be regarded as a code\n * template only. It will require modifications to work:\n * - It may require correct/in-range values for request initialization.\n * - It may require specifying regional endpoints when creating the service client,\n * please see the apiEndpoint client configuration option for more details.\n */\n function partition_query_sample(): void\n {\n // Create a client.\n $firestoreClient = new FirestoreClient();\n\n // Prepare the request message.\n $request = new PartitionQueryRequest();\n\n // Call the API and handle any network failures.\n try {\n /** @var PagedListResponse $response */\n $response = $firestoreClient-\u003epartitionQuery($request);\n\n /** @var Cursor $element */\n foreach ($response as $element) {\n printf('Element data: %s' . PHP_EOL, $element-\u003eserializeToJsonString());\n }\n } catch (ApiException $ex) {\n printf('Call failed with message: %s' . PHP_EOL, $ex-\u003egetMessage());\n }\n }\n\n### static::anyPathName\n\nFormats a string containing the fully-qualified path to represent\na any_path resource.\n\n### static::databaseRootName\n\nFormats a string containing the fully-qualified path to represent\na database_root resource.\n\n### static::documentPathName\n\nFormats a string containing the fully-qualified path to represent\na document_path resource.\n\n### static::documentRootName\n\nFormats a string containing the fully-qualified path to represent\na document_root resource.\n\n### static::parseName\n\nParses a formatted name string and returns an associative array of the components in the name.\n\nThe following name formats are supported:\nTemplate: Pattern\n\n- anyPath: projects/{project}/databases/{database}/documents/{document}/{any_path=\\*\\*}\n- databaseRoot: projects/{project}/databases/{database}\n- documentPath: projects/{project}/databases/{database}/documents/{document_path=\\*\\*}\n- documentRoot: projects/{project}/databases/{database}/documents.\n\nThe optional $template argument can be supplied to specify a particular pattern, and must\nmatch one of the templates listed above. If no $template argument is provided, or if the\n$template argument does not match one of the templates listed, then parseName will check\neach of the supported templates, and return the first match."]]