Skip to content
Snippets Groups Projects
Commit 55bff483 authored by Stanley Cheung's avatar Stanley Cheung
Browse files

PHP: proto3 API change

parent 38ea6037
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment