• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

PHP -> Flash Builder Type Mapping

New Here ,
Sep 02, 2011 Sep 02, 2011

Copy link to clipboard

Copied

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#Zend_Amf-WadeArnold-TypeMapping... - 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!

Views

1.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 11, 2012 Jan 11, 2012

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 30, 2012 Apr 30, 2012

Copy link to clipboard

Copied

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

Any help would be appreciated.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 30, 2012 Apr 30, 2012

Copy link to clipboard

Copied

I'd just about given up on this forum, so apologies for not posting my solution...

Anyway, it's a kludge, but you basically have to declare the variable as a string:

     /**

     * @var string

     */

     public $int64Num;

The corresponding valueObject string can be used in functions, e.g.:

var f:Frame = value as Frame; // corresponding valueObject

var dt : Date = new Date();

dt.setTime(f.int64Num);

The solution to the second problem is to declare something in your PHP service which returns a single (i.e. non-array) version of the PHP object, e.g.:

/**

* @return Frame

*/

public function emptyFrame() {

     return new Frame();

}

/**

* @return Frame[]

*/

public function getAllFrames() {

     ...

}

Hope this helps someone...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 11, 2013 Feb 11, 2013

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines