我有一个protobuf emun,我在另一条消息中用作字段。我还为此枚举添加了一个自定义选项,为每个选项设置文本版本值
syntax = "proto3";
import "google/protobuf/descriptor.proto";
package Message;
extend google.protobuf.EnumValueOptions {
optional string name = 10001;
}
enum ScreenshotStatus {
UNKNOWN = 0 [(name) = "unknown"];
IN_QUEUE = 1 [(name) = "in_queue"];
PROGRESSING = 2 [(name) = "[progressing"];
FINISHED = 3 [(name) = "finished"];
RUNNING = 4 [(name) = "running"];
}
然而,当我为protobufs生成php类时,我得到普通的旧类,没有任何方法来获取枚举名称。
class ScreenshotStatus
{
/**
* Generated from protobuf enum <code>UNKNOWN = 0 [(.Message.name) = "unknown"];</code>
*/
const UNKNOWN = 0;
}
有没有办法获取ScreenshotStatus :: UNKNOWN的名称值,反之亦然 - 按名称获取正确的枚举&#34; unknown&#34;。