arraycollectionzend-amf

ZendAMF 1.11 and the missing source


We are trying to upgrade from an older version of Zend Framework to the most recent one (1.11).

We have to send some ArrayCollections to a Flex-app that I can not access. Previous versions of ZF's Zend_Amf_Value_Messaging_ArrayCollection have a source attribute which the newer versions don't have.

I have tried editing the Zend_Amf_Value_Messaging_ArrayCollection class to have that source property, but it seems like ZF doesn't send objects to the Flex-app (I've noticed that via a debugging proxy). The ArrayCollection still has the correct keys (AFAIK, going from 0 -> 3), but the values are NULL.

This is from a small test-file:

$c = new RoomCategoryVO();
$c->name = 'root';
$c->childCategories = new Zend_Amf_Value_Messaging_ArrayCollection();

$cc1 = new RoomCategoryVO();
$cc1->sortPriority = 2;
$cc1->name = $this->xml->roomService->windows;
$cc1->parentCategory = $c;
$cc1->childItems = new Zend_Amf_Value_Messaging_ArrayCollection();
$re11 = new ElementVO();
$re11->id = "simpleWindow";
$re11->name = $this->xml->roomService->window;
$re11->type = 'SIMPLE_WINDOW';
$re11->icon = 'assets/runtime/images/schemeIcons/simpleWindow.png';
//$cc1->childItems->source[] = $re11;
$cc1->childItems[] = $re11;


//$c->childCategories->source[] = $cc1;
$c->childCategories->append($cc1);

In comments you see the 'old' way of ZendAMF, below them the new way.

Is there any way to get ZendAMF use the source property again without going back to an older version of ZF?


Solution

  • We finally settled on using ZendAMF, with only the Zend_Amf_Value_Messaging_ArrayCollection from the previous version being:

    class Zend_Amf_Value_Messaging_ArrayCollection
    {
        public $source;
    }
    

    This allows us still using the source property.