Stanislav created THRIFT-5082:
---------------------------------

             Summary: Add a Class reference for PHP enum $_TSPEC
                 Key: THRIFT-5082
                 URL: https://issues.apache.org/jira/browse/THRIFT-5082
             Project: Thrift
          Issue Type: Improvement
          Components: PHP - Compiler
            Reporter: Stanislav


Currently we are losing the connection between the structure enum parameter 
value and the enum definition itself in PHP.

 

The following thrift parameter which is using GroupType enum:
{code:java}
5: required GroupType group_type;{code}
Is compiled to PHP:
{code:java}
5 => array(
  'var' => 'group_type',
  'isRequired' => true,
  'type' => TType::I32,
 ),{code}
 

Which means that we cannot say on PHP side if that is a regular *i32* or an 
*enum*.

*Why do I need that?*

I am using lowercase enum values instead of integers in database and on the 
frontend. Currently converting them by manually specifying the Enum Classes for 
enum parameters for each Structure which is not scalable, more difficult to 
maintain and growing over time. 

This also makes it impossible to validate fields by Enum values on php side.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to