I've been trying to assemble data suitable for building a Dojo tree widget.
I've assembled my data as an associative array (actually an assoc. arr. of
objects, but that's not relevant), which seems intuitive to me - in any
event, there's no way around it that I can see for my use-case.
The problem comes when I try to cast it to a Dojo_Data object. Passing an
associative array to Zend_Dojo_Data gives the (somewhat misleading) error
message 'Only arrays and objects may be attached'. I've worked around it by
converting my assoc. array to a simple array, but it seems ugly & bizarre to
me.
So, my question is, (how) should Zend_Dojo_Data handle associative arrays?
I'm happy to write some code for it, but am not clear exactly what the
solution should be. Any input?
$testArr = array(
'id' => 1,
'description' => 'some description',
'children' => array(
'someName' => array(
'id' => 2,
'description' => 'some description2',
'children' => array(
'someDeepName' => array(
'id' => 3,
'description' => 'some deep description2',
),
'someOtherDeepName' => array(
'id' => 4,
'description' => 'some deep description4',
),
),
),
),
);
$data = new Zend_Dojo_Data('id', $testArr);
Exception:
Error: Only arrays and objects may be attached.
--
View this message in context:
http://www.nabble.com/RFC%3A-Zend_Dojo_Data---associative-arrays-tp23175415p23175415.html
Sent from the Zend Framework mailing list archive at Nabble.com.