|
As you pointed out it is very difficult to de-serialize, instantiate the classmap class if it exists, and then populate it with data. I will check out what you spoke of and see what I can do to get something added for round trip with AS3 specifying the mapping. Really appreciate the suggestions, links, and general feedback. Sure, here they are: SabreAMF wiki http://code.google.com/p/sabreamf/w/list The place that does all the magic: SabreAMF_ClassMapper::$onGetLocalClass = 'flashToPHPClass'; where flashToPHPClass and PHPToFlashClass are simple custom php functions. or : SabreAMF_ClassMapper::$onGetLocalClass = array($classOrInstance, 'flashToPHPClass'); as callbacks. Example: // actionscript // php if one wants a class mapping between those, the callback functions could look like: function flashToPHPClass($alias) { // so that it returns a class with "package" prefix and without the VO termination this can allow any naming convetion/class mapping system imagined. look further on that wiki page and talk with "evertpot", he answers mails and cares about amf/php world on a different level, just like you. This is something be worked on for better mapping from Flex. Zend Amf is definitely PHP centric in regards to class mapping. Our Zend_Amf_Server has over 250 object types (classes). If we need to set the mappings via "$server->setClassMap" then we also have to import all php files with classes. The result is 250 "require_once"! And every new "require_once" in the server script makes the AMF server slower and slower... Example: Result: the speed will be increased over 10 times! |
||||||||||||||||||||||||||||||||||||
After reading a whole lot about this "issue" i have discovered it is not such a trivial task.
Wade, you should check out SabreAMF and offer those features in Zend_AMF also.
They have a way of settings your own class mapping callback functions.
The issue with classmapping in php will and always be the loading/autoloading of classes, it is just the way php works.
One sollutions will be to create a certain convention on class mapping, but this is limiting, the best way is leave it as it is and add support for overriding class maping through custom callback functions, just as SabreAMF does, please take a look, it will get you rid of a lot of problems and questions.