Skip navigation
wisewellies
Currently Being Moderated

PHP -> Flash Builder Type Mapping

Sep 2, 2011 3:41 AM

Does anyone have a comprehensive list mapping PHP data types to those in Flash Builder, specifically so that they are understood when using the Data|Connect to PHP menu? I have worked out most of them, but I'm having trouble mapping integers larger than 32 bits and floating point numbers from PHP to Flash Builder.

 

For instance:

 

<?php

 

class Frame {

     /**

     * @var integer

     */

     public $id;

 

     /**

     * @var float

     */

     public $fpNum;

 

     /**

     * @var int

     */

     public $int32Num;

 

     /**

     * @var float

     */

     public $int64Num;

 

 

results in an Actionscript valueObject that has corresponding types of int, int, int and int. This doesn't seem right - surely a float should become a Number, and likewise with a 64-bit integer?

 

The only information that I've been able to find is here: http://framework.zend.com/wiki/display/ZFPROP/Zend_Amf+-+Wade+Arnold#Z end_Amf-WadeArnold-TypeMappingTable - but Flash Builder doesn't seem to behave according to the table. I know that it's possible to override the mappings, but it would be nice if Flash Builder understood how to map them properly. Any ideas?

 

I've also found that Flash Builder is unable to determine data types for arrays of objects, or if a type is used as a child of a returned type. In this instance, adding a dummy function to PHP to return an empty object of the 'missing' type seems to work - but really shouldn't be necessary.

 

Any thoughts/insights would be warmly welcomed!

 
Replies
  • Currently Being Moderated
    Jan 11, 2012 11:58 AM   in reply to wisewellies

    Did you ever figure this out?  I'm having the same problem.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 30, 2012 9:03 AM   in reply to wisewellies

    Did you ever find a solution to this?  I am trying to map the types for floats and arrays.

     

    Any help would be appreciated.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 11, 2013 1:54 AM   in reply to wisewellies

    FYI, I just found a workaround for mapping double/float in PHP with Number in AS. If you change static data mappings in a target service manually, FB will convert double/float to Number automatically. Your service information can be found in YOUR_WORKSPACE/YOUR_PROJECT/.model/YOUR_PROJECT_NAME.fml.

     

    1. Open the model file using any text editor. (I use Notepad++ because it has a nice syntax highlight feature.)

    2. Find your entity notation. i.e. <entity name="Frame">....</entity>

    3. You can find your property within the entity. i.e. <property name="fpNum" type="integer" required="true"/>

    4. Change type from integer to double. i.e. <property name="fpNum" type="double" required="true"/>

    5. Restart your FB.

     

    Note there is a downside. Whenever you refresh/reconnect to your service, you need to change them again. Otherwise, you'll lost your data mapping. I hope this help someone.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points