6 Replies Latest reply on Jun 25, 2009 1:07 AM by emphasized

    AS -> Zend impossible sending Array of (custom) Objects

    emphasized Level 1

      Hi I've spend hours on this problem trying numerous things to fix this.

      The problem arrises when you create a webservice with Flash Builder and you create a php function accepting an array. When (back in Flash Builder) you call the method ex:

      _service.addNotes(aNotes, _oUser.id);

       

      where "_service" is a instance of the auto-generated as class:

       

       

       

       

       

       

      _service =

       

      new NoteService();

      _service.endpoint =

       

      "linkto/gateway.php";

      _service.destination="NoteService";

      _service.source=

       

      "NoteService";

      _service.showBusyCursor =true;

       

      Now when I trace the content of the array which contains objects of the instance NoteObject (so a custom class) in Charles:

      Array
      (
          [0] => stdClass Object
              (
                  [sortOrder] => 0
                  [date] => 1245761170000
                  [creationDate] => 1245761170000
                  [id] => 3
                  [deletionDate] => 0
                  [remoteId] => 0
                  [message] => three

              )

          [1] => Zend_Amf_Value_Messaging_RemotingMessage Object
              (
                  [source] => 0
                  [operation] => 1245761169000
                  [parameters] =>
                  [clientId] => 2
                  [destination] => 0
                  [messageId] => 0
                  [timestamp] => two

                  [timeToLive] => Zend_Amf_Value_Messaging_RemotingMessage Object
                      (
                          [source] => 0
                          [operation] => 1245761168000
                          [parameters] =>
                          [clientId] => 1
                          [destination] => 0
                          [messageId] => 0
                          [timestamp] => one

                          [timeToLive] => 1
                          [headers] => 1245761168000
                          [body] => 0
                      )

                  [headers] => 1245761169000
                  [body] => 0
              )

          [2] => C80C5A13-C378-115A-99AD-0D7A21DAD456
      )

       

      This being really messed up I tryed mapping them to instance of the type Object which results in this:

       

      Array
      (
          [0] => stdClass Object
              (
                  [message] => three

                  [remoteId] => 0
                  [date] => 1245761170000
                  [deletionDate] => 0
                  [sortOrder] => 0
                  [creationDate] => 1245761170000
                  [id] => 3
              )

          [1] => stdClass Object
              (
                  [E95B572C-B126-026F-AF64-0D7C4C6F1D7B] => two

                  [source] => 0
                  [operation] => 1245761169000
                  [headers] => 0
                  [destination] => 0
                  [clientId] => 1245761169000
                  [body] => 2
              )

          [2] => stdClass Object
              (
                  [E95B572C-B126-026F-AF64-0D7C4C6F1D7B] => one

                  [source] => 0
                  [operation] => 1245761168000
                  [headers] => 0
                  [destination] => 0
                  [clientId] => 1245761168000
                  [body] => 1
              )

      )

       

       

      Now why does Zend mess things up? I googled for hours; tried serialization of my objects; working with the ... args method ; etc,...