diff options
author | Paul Yang <TeBoring@users.noreply.github.com> | 2017-04-24 12:40:37 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-24 12:40:37 -0700 |
commit | fba2acd72e8cbf138912295df227ee2c914158c3 (patch) | |
tree | e67673627fad3a5945f90abcd6cf94b1b9d4eb67 /php/src/Google | |
parent | e64b618b2132237f9901da0dc76bb0d50ac35d71 (diff) | |
download | protobuf-fba2acd72e8cbf138912295df227ee2c914158c3.tar.gz protobuf-fba2acd72e8cbf138912295df227ee2c914158c3.tar.bz2 protobuf-fba2acd72e8cbf138912295df227ee2c914158c3.zip |
Add nested enum descriptor in php rumtime. (#3009)v3.3.0rc1
Diffstat (limited to 'php/src/Google')
-rw-r--r-- | php/src/Google/Protobuf/Internal/DescriptorPool.php | 3 | ||||
-rw-r--r-- | php/src/Google/Protobuf/descriptor.php | 6 |
2 files changed, 9 insertions, 0 deletions
diff --git a/php/src/Google/Protobuf/Internal/DescriptorPool.php b/php/src/Google/Protobuf/Internal/DescriptorPool.php index 1ef403cf..2c00dfb6 100644 --- a/php/src/Google/Protobuf/Internal/DescriptorPool.php +++ b/php/src/Google/Protobuf/Internal/DescriptorPool.php @@ -95,6 +95,9 @@ class DescriptorPool foreach ($descriptor->getNestedType() as $nested_type) { $this->addDescriptor($nested_type); } + foreach ($descriptor->getEnumType() as $enum_type) { + $this->addEnumDescriptor($enum_type); + } } public function addEnumDescriptor($descriptor) diff --git a/php/src/Google/Protobuf/descriptor.php b/php/src/Google/Protobuf/descriptor.php index 9c744a8a..fb69eda0 100644 --- a/php/src/Google/Protobuf/descriptor.php +++ b/php/src/Google/Protobuf/descriptor.php @@ -210,6 +210,12 @@ class Descriptor $nested_proto, $file_proto, $message_name_without_package)); } + // Handle nested enum. + foreach ($proto->getEnumType() as $enum_proto) { + $desc->addEnumType(EnumDescriptor::buildFromProto( + $enum_proto, $file_proto, $message_name_without_package)); + } + // Handle oneof fields. foreach ($proto->getOneofDecl() as $oneof_proto) { $desc->addOneofDecl( |