From fad4022373828816a8fcee9aedfa2969734fd02b Mon Sep 17 00:00:00 2001 From: yash30201 <54198301+yash30201@users.noreply.github.com> Date: Mon, 6 May 2024 14:09:03 +0000 Subject: [PATCH] Iteration 1 --- Datastore/src/DatastoreClient.php | 10 +++++++--- Datastore/src/Operation.php | 13 +------------ 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/Datastore/src/DatastoreClient.php b/Datastore/src/DatastoreClient.php index 5f7eadd047ab..aa13e7139c46 100644 --- a/Datastore/src/DatastoreClient.php +++ b/Datastore/src/DatastoreClient.php @@ -98,6 +98,10 @@ class DatastoreClient const FULL_CONTROL_SCOPE = 'https://www.googleapis.com/auth/datastore'; + /** + * Keeping this consistent with veneer libraries where + * multiple clients are present. + */ private const GAPIC_KEYS = [ V1DatastoreClient::class ]; @@ -108,7 +112,7 @@ class DatastoreClient * The request handler responsible for sending requests and * serializing responses into relevant classes. */ - protected $requestHandler; + private $requestHandler; /** * @var Serializer @@ -609,7 +613,7 @@ public function transaction(array $options = []) { $transaction = $this->operation->beginTransaction([ // if empty, force request to encode as {} rather than []. - 'readWrite' => $this->pluck('transactionOptions', $options, false) ?: (object) [] + 'readWrite' => $this->pluck('transactionOptions', $options, false) ?: [] ], $options); return new Transaction( @@ -648,7 +652,7 @@ public function readOnlyTransaction(array $options = []) { $transaction = $this->operation->beginTransaction([ // if empty, force request to encode as {} rather than []. - 'readOnly' => $this->pluck('transactionOptions', $options, false) ?: (object) [] + 'readOnly' => $this->pluck('transactionOptions', $options, false) ?: [] ], $options); return new ReadOnlyTransaction( diff --git a/Datastore/src/Operation.php b/Datastore/src/Operation.php index b6e7bd11c3e0..88a7f0cc7215 100644 --- a/Datastore/src/Operation.php +++ b/Datastore/src/Operation.php @@ -77,7 +77,7 @@ class Operation * The request handler responsible for sending requests and * serializing responses into relevant classes. */ - protected RequestHandler $requestHandler; + private RequestHandler $requestHandler; /** * @var Serializer @@ -317,12 +317,6 @@ public function beginTransaction($transactionOptions, array $options = []) ); } - array_walk($transactionOptions, function (&$item) { - if ($item instanceof \stdClass) { - $item = []; - } - }); - list($data, $optionalArgs) = $this->splitOptionalArgs($options); $data += [ @@ -599,11 +593,6 @@ public function runQuery(QueryInterface $query, array $options = []) 'readConsistency', 'transaction' ]); - $data = $this->convertDataToProtos($data, [ - 'partitionId' => PartitionId::class, - 'readOptions' => ReadOptions::class, - 'explainOptions' => ExplainOptions::class - ]); if (isset($data['query'])) { $data['query'] = $this->parseQuery($data['query']); }