Skip to content

Commit

Permalink
Remove all nested level decodeMessage calls
Browse files Browse the repository at this point in the history
  • Loading branch information
yash30201 authored May 7, 2024
2 parents b49f2db + 0ab053d commit 4040d1c
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions Datastore/src/Operation.php
Original file line number Diff line number Diff line change
Expand Up @@ -1004,10 +1004,10 @@ private function keysList(array $keys)
}

/**
* Convert array representation of Query to {@see Google\Cloud\Datastore\V1\Query}.
* Parse query into API compatible values
*
* @param array $query
* @return V1Query
* @return array
*/
private function parseQuery(array $query)
{
Expand All @@ -1029,18 +1029,14 @@ private function parseQuery(array $query)
];
}

$parsedQuery = $this->serializer->decodeMessage(
new V1Query(),
$query
);
return $parsedQuery;
return $query;
}

/**
* Convert array representation of GqlQuery to {@see Google\Cloud\Datastore\V1\GqlQuery}.
* Parse query into API compatible values
*
* @param array $gqlQuery
* @return GqlQuery
* @return array
*/
private function parseGqlQuery(array $gqlQuery)
{
Expand All @@ -1064,12 +1060,7 @@ private function parseGqlQuery(array $gqlQuery)
}
}

$parsedGqlQuery = $this->serializer->decodeMessage(
new GqlQuery(),
$gqlQuery
);

return $parsedGqlQuery;
return $gqlQuery;
}

/**
Expand Down Expand Up @@ -1226,8 +1217,6 @@ private function parseCommitOptions($mutations, $options)
}

$mutation[$mutationType] = $data;

$mutation = $this->serializer->decodeMessage(new Mutation(), $mutation);
}

$options += [
Expand Down

0 comments on commit 4040d1c

Please sign in to comment.