[ 
https://issues.apache.org/jira/browse/THRIFT-779?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12867344#action_12867344
 ] 

David Reiss commented on THRIFT-779:
------------------------------------

It also increases the complexity of Thrift and decreases the consistency 
between languages.

> PHP - enums as string
> ---------------------
>
>                 Key: THRIFT-779
>                 URL: https://issues.apache.org/jira/browse/THRIFT-779
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Compiler (PHP), Library (PHP)
>            Reporter: Jan Dolecek
>            Priority: Minor
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
> I've created patch for php code generator and for php library, which will 
> allow you to use string in enums (these string will be converted from/to 
> integers while receiving/sending).
> Example:
> // thrift definition
> enum CheckService {
>       ping = 1,
>       ssh = 2,
>       http = 3,
>       telnet = 4,
> }
> Now, you can send as value 'ping' or 1, the protocol will always transfer I32 
> of value 1.
> When receiving on other side, 1 is automatically converted to 'ping'.
> By default, this patch has no effect. To turn on the conversion, you have to 
> activate on whole thrift by
> TBase::$allowEnumConversion = true;
> or per struct MyStruct::$allowEnumConversion = true; which will turn on 
> convertion for all enums directly accessible from this struct (but not in 
> structs on deeper level)
> (this patch includes patch for namespaces, I posted some days before)
> Link 1 (php library patch): 
> http://helemik.cz/juzna/opensource/php/thrift/p-enum.patch
> Link 2 (php compiler patch): 
> http://helemik.cz/juzna/opensource/php/thrift/p-enum2.patch
> (Is it possible to join in to upstream? Please, someone "who's in" charge, 
> concat me on my email or on IRC)
> juzna

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to