Issues

ZF-6601: Unable to send ArrayCollection as input argument from flex

Issue Type: Bug Created: 2009-05-11T03:06:52.000+0000 Last Updated: 2010-02-10T03:24:50.000+0000 Status: Resolved Fix version(s): - 1.8.2 (27/May/09)

Reporter: Gaurav Priyadarshi (gauravp) Assignee: Stanislav Malyshev (stas) Tags: - Zend_Amf

Related issues: Attachments:

Description

Trying to send an ArrayCollection from flex to ZendAMF leads to following error:

Fatal error: Uncaught exception 'Zend_Amf_Exception' with message 'Unable to parse null body data flex.messaging.io.ArrayCollection mapped class is not defined' in C:\wamp\www\ZendFramework\library\Zend\Amf\Request.php:174 Stack trace:

0 C:\wamp\www\ZendFramework\library\Zend\Amf\Request.php(125): Zend_Amf_Request->readBody()

1 C:\wamp\www\ZendFramework\library\Zend\Amf\Request.php(93): Zend_Amf_Request->readMessage(Object(Zend_Amf_Parse_InputStream))

2 C:\wamp\www\ZendFramework\library\Zend\Amf\Request\Http.php(64): Zend_Amf_Request->initialize('????????null??/...')

3 C:\wamp\www\ZendFramework\library\Zend\Amf\Server.php(432): Zend_Amf_Request_Http->__construct()

4 C:\wamp\www\ZendFramework\library\Zend\Amf\Server.php(374): Zend_Amf_Server->getRequest()

5 C:\wamp\www\TestZend1-debug\gateway.php(50): Zend_Amf_Server->handle()

6 {main}

thrown in C:\wamp\www\ZendFramework\library\Zend\Amf\Request.php on line 174

Sample code to do this can be:

protected function fxapplication1_creationCompleteHandler(event:FlexEvent):void { var a:ArrayCollection = new ArrayCollection();

a.addItem('hello');

a.addItem('world');


srv.createItem(a);

}

ArrayCollections should be supported as it is widely used in flex.

Comments

Posted by Stanislav Malyshev (stas) on 2009-05-14T14:54:05.000+0000

Fixed - ArrayCollection now is converted to array.

Posted by shibby (shibby44) on 2010-02-07T13:56:54.000+0000

Stanislav,

I tried with the code supplied by Gaurav Priyadarshi and had no success retrieving the ArrayCollection on my php class.

Would you mind putting an example on how to send the ArrayCollection to PHP and use it there now that the issue is fixed?

Thanks in advance.

Posted by shibby (shibby44) on 2010-02-10T03:24:50.000+0000

I figured it out myself.

On your flex code convert your ArrayCollections to Array and you are ready to go.

protected function fxapplication1_creationCompleteHandler(event:FlexEvent):void {

var a:ArrayCollection = new ArrayCollection(); a.addItem('hello'); a.addItem('world');

var b:Array = a.toArray(); srv.createItem(b);

}

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts