CakePHP CPAMF flex VO object flash integration

Well thank god for that!

After a few days of stressing and pulling out hair, and with the help of one young dutch genius we managed to resolve the cake cpamf plugin VO integration.

Firstly, things to know about cake:

  1. Cake REQUIRES all models to be in the “models” directory.
  2. CPAMF plugin is installed in in the “plugins” directory.
  3. You can view all controllers/services at /cpamf/browser
  4. The gateway that flash connects to is /cpamf/gateway (not /cpamf/gateway.php as the default seems to think).
  5. CPAMF does NOT use the vendor/services/vo directory that is inside the amfphp part of the plugin.

Flash RemoteClass alias can be any path

e.g.

package
[RemoteClass(alias="org.test.TestOp")]
/**
* @author
*/
public class TestOP
{
public var username:String;
public var password:String;
public var id:int;
public function TestOP( username:String=null, password:String=null, id:int=0) {
this.username = username;
this.password = password;
this.id = id;
}
}
}

This class path MUST be represented in the PHP class using the _explicitType = ‘org.test.TestOp’. Once this is done you can pass back this class through any controller method.

e.g.

class TestOp {
public $_explicitType = 'org.test.TestOp';
public $username;
public $password;
public $id;
}

So, as you can see from the above, the PHP class MUST have the full package path to the flash class, and your class will be “models/test_op.php” as cake has a horrid non-pear style naming convention.

Tags: , ,

Leave a Reply