Archive for March 21st, 2008

AMFPHP Deserializer and POG classes

The default AMFPHP patterns for including classes defined in your AMF requests do not work for POG classes. The two default patterns that are check for class including by the AMF deserializer are:

PHP:
  1. // $mappedClass = SomeObject
  2. $mappedClass . "php" // SomeObject.php
  3. // or
  4. $mappedClass . ".class.php" //SomeObject.class.php

For POG classes the pattern is "class.someobject.php", regardless of the case of the SomeObject class.

Now to added different locations for AMFPHP to look for classes to include for deserialization of AMF requests you open up /amfphp/core/amf/io/AMFBaseDeserializer.php. Go to line 384 (as of AMFPHP 1.9 or the block of code starting with file_exists($GLOBALS['amfphp']['customMappingsPath']) and add the following code for POG classes pattern:

PHP:
  1. elseif(file_exists($GLOBALS['amfphp']['customMappingsPath'] . 'class.' . strtolower($mappedClass) . '.php'))
  2. {
  3.     $include = $GLOBALS['amfphp']['customMappingsPath'] . 'class.' . strtolower($mappedClass) . '.php';
  4. }

Now your AMF request classes passed in method parameters will be deserialized on the PHP to the correct POG class.

3 comments March 21st, 2008



About: I work as a Platform Evangelist for Adobe Systems Incorporated.

My Amazon.com Wish List

Calendar

March 2008
S M T W T F S
« Feb   May »
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

Posts by Month

Posts by Category


Flex.org - The Directory for Flex