PHP: proto3 API change

pull/10134/head
Stanley Cheung 8 years ago
parent 38ea603770
commit 55bff48335
  1. 8
      src/php/lib/Grpc/AbstractCall.php

@ -131,6 +131,8 @@ abstract class AbstractCall
// Proto3 implementation
if (method_exists($data, 'encode')) {
return $data->encode();
} else if (method_exists($data, 'serializeToString')) {
return $data->serializeToString();
}
// Protobuf-PHP implementation
@ -154,7 +156,11 @@ abstract class AbstractCall
if (is_array($this->deserialize)) {
list($className, $deserializeFunc) = $this->deserialize;
$obj = new $className();
$obj->$deserializeFunc($value);
if (method_exists($obj, $deserializeFunc)) {
$obj->$deserializeFunc($value);
} else {
$obj->mergeFromString($value);
}
return $obj;
}

Loading…
Cancel
Save