You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "David Reiss (JIRA)" <ji...@apache.org> on 2010/05/17 19:52:43 UTC

[jira] Resolved: (THRIFT-779) PHP - enums as string

     [ https://issues.apache.org/jira/browse/THRIFT-779?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David Reiss resolved THRIFT-779.
--------------------------------

    Resolution: Won't Fix

> 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.