aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar ZhouyihaiDing <ddyihai@google.com>2017-11-30 14:11:38 -0800
committerGravatar ZhouyihaiDing <ddyihai@google.com>2018-03-05 10:37:45 -0800
commit39a4746ca6f811b5daf202e4b8e1898f6969da32 (patch)
treeafbc5fa3f26a384b5041897d2e11991bc60fc5a3 /src
parentaa7fa513c12740d85f100ffe2dea465962c1ab97 (diff)
update php plugin with protobuf 3.5.0
Diffstat (limited to 'src')
-rw-r--r--src/compiler/php_generator.cc14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/compiler/php_generator.cc b/src/compiler/php_generator.cc
index d9705e8077..ca084cccbd 100644
--- a/src/compiler/php_generator.cc
+++ b/src/compiler/php_generator.cc
@@ -18,10 +18,12 @@
#include <map>
+#include <google/protobuf/compiler/php/php_generator.h>
#include "src/compiler/config.h"
#include "src/compiler/generator_helpers.h"
#include "src/compiler/php_generator_helpers.h"
+using google::protobuf::compiler::php::GeneratedClassName;
using grpc::protobuf::Descriptor;
using grpc::protobuf::FileDescriptor;
using grpc::protobuf::MethodDescriptor;
@@ -55,8 +57,10 @@ grpc::string MessageIdentifierName(const grpc::string& name,
const FileDescriptor* file) {
std::vector<grpc::string> tokens = grpc_generator::tokenize(name, ".");
std::ostringstream oss;
- oss << PackageName(file) << "\\"
- << grpc_generator::CapitalizeFirstLetter(tokens[tokens.size() - 1]);
+ if (PackageName(file) != "") {
+ oss << PackageName(file) << "\\";
+ }
+ oss << grpc_generator::CapitalizeFirstLetter(tokens[tokens.size() - 1]);
return oss.str();
}
@@ -67,9 +71,9 @@ void PrintMethod(const MethodDescriptor* method, Printer* out) {
vars["service_name"] = method->service()->full_name();
vars["name"] = method->name();
vars["input_type_id"] =
- MessageIdentifierName(input_type->full_name(), input_type->file());
- vars["output_type_id"] =
- MessageIdentifierName(output_type->full_name(), output_type->file());
+ MessageIdentifierName(GeneratedClassName(input_type), input_type->file());
+ vars["output_type_id"] = MessageIdentifierName(
+ GeneratedClassName(output_type), output_type->file());
out->Print("/**\n");
out->Print(GetPHPComments(method, " *").c_str());