Skip to content

Commit

Permalink
Merge branch 'datastore-php-v2' of https://github.com/yash30201/googl…
Browse files Browse the repository at this point in the history
…e-cloud-php into datastore-php-v2
  • Loading branch information
yash30201 committed May 7, 2024
2 parents b49d34e + 7e1dfa3 commit 2f33be4
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Datastore/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"minimum-stability": "stable",
"require": {
"php": "^8.0",
"google/cloud-core": "^1.57",
"google/cloud-core": "^1.59",
"google/gax": "^1.30"
},
"require-dev": {
Expand Down
48 changes: 27 additions & 21 deletions Datastore/src/Operation.php
Original file line number Diff line number Diff line change
Expand Up @@ -454,19 +454,19 @@ public function lookup(array $keys, array $options = [])
$serviceKeys[] = $key->keyObject();
});

list($data, $optionalArgs) = $this->splitOptionalArgs($options, [
'transaction',
'className',
'sort',
'readTime',
'readConsistency'
]);
list($data, $optionalArgs) = $this->splitOptionalArgs($options);
$data += $this->readOptions($options) + [
'projectId' => $this->projectId,
'databaseId' => $this->databaseId,
'keys' => $this->keysList($serviceKeys),
];

// Remove redundant keys for request.
$this->pluckArray(
['transaction', 'className', 'sort', 'readTime', 'readConsistency'],
$data
);

$request = $this->serializer->decodeMessage(new LookupRequest(), $data);

$res = $this->requestHandler->sendRequest(
Expand Down Expand Up @@ -585,13 +585,14 @@ public function runQuery(QueryInterface $query, array $options = [])
$runQueryObj->queryKey() => $requestQueryArr,
] + $this->readOptions($options) + $options;

list($data, $optionalArgs) = $this->splitOptionalArgs($req, [
'className',
'namespaceId',
'readTime',
'readConsistency',
'transaction'
]);
list($data, $optionalArgs) = $this->splitOptionalArgs($req);

// Remove redundant keys for request.
$this->pluckArray(
['className', 'namespaceId', 'readTime', 'readConsistency', 'transaction'],
$data
);

if (isset($data['query'])) {
$data['query'] = $this->parseQuery($data['query']);
}
Expand Down Expand Up @@ -679,12 +680,13 @@ public function runAggregationQuery(AggregationQuery $runQueryObj, array $option
),
] + $requestQueryArr + $this->readOptions($options) + $options;

list($data, $optionalArgs) = $this->splitOptionalArgs($req, [
'namespaceId',
'readTime',
'readConsistency',
'transaction'
]);
list($data, $optionalArgs) = $this->splitOptionalArgs($req);

// Remove redundant keys for request.
$this->pluckArray(
['namespaceId', 'readTime', 'readConsistency', 'transaction'],
$data
);

if (isset($data['aggregationQuery'])) {
if (isset($data['aggregationQuery']['nestedQuery'])) {
Expand Down Expand Up @@ -764,7 +766,11 @@ public function commit(array $mutations, array $options = [])
// Remove 'transaction' if set to `null` to avoid serialization error
unset($options['transaction']);
}
list($data, $optionalArgs) = $this->splitOptionalArgs($options, ['allowOverwrite', 'baseVersion']);
list($data, $optionalArgs) = $this->splitOptionalArgs($options);

// Remove redundant keys for request.
$this->pluckArray(['allowOverwrite', 'baseVersion'], $data);

$request = $this->serializer->decodeMessage(new CommitRequest(), $data);
$res = $this->requestHandler->sendRequest(
DatastoreClient::class,
Expand Down

0 comments on commit 2f33be4

Please sign in to comment.